question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Performance improvements

See original GitHub issue

I’ve been doing some performance analysis with chrome dev tools because fps was pretty low for my usage.

  1. PUID is really inefficient as it gets called a lot and iterate over the whole array of particles. Replacing the array with a Map looks like a better idea
export default {
    _id: 0,
    _uids: new Map(), //maps objects to IDs
    id: function (functionOrObject) {
        if (this._uids.has(functionOrObject))
            return this._uids.get(functionOrObject);

        const nid = 'PUID_' + this._id++;

        this._uids.set(functionOrObject, nid);

        return nid;
    }
};
  1. Setting rotation for Sprites in MeshRenderer consumes a lot of CPU for nothing… as rotating a Sprite has no effect (you need to rotate the material)
constructor(container, THREE) {
        [...]
        this._THREE = THREE;
    }
[...]
onParticleUpdate(particle) {
        if (particle.target) {
            particle.target.position.copy(particle.position);
            if (!(particle.target instanceof this._THREE.Sprite))
                particle.target.rotation.set(
                    particle.rotation.x,
                    particle.rotation.y,
                    particle.rotation.z
                );
            this.scale(particle);

            if (particle.useAlpha) {
                particle.target.material.opacity = particle.alpha;
                particle.target.material.transparent = true;
            }

            if (particle.useColor) {
                particle.target.material.color.copy(particle.color);
            }
        }
    }

(alternatively, could override the whole function in SpriteRenderer)

Could you fix these or do you need a PR @rohan-deshpande ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:21

github_iconTop GitHub Comments

1reaction
rohan-deshpandecommented, Feb 24, 2020

Okay yep, it’s an issue, I will track this in a new issue and mention you there @davidpox thanks for reporting

1reaction
davidpoxcommented, Feb 21, 2020

Hey all, I’m also testing the GPURenderer and the performance improvement is incredible. I’m having issues with rendering however, seems like depth-testing isn’t working. chrome_ed6PRlcrc2 chrome_AVWCXcnV4f

System is created like so:

new Nebula.System.fromJSONAsync(json, THREE)
	.then(system => {
		this._system = system;
		this._emitter = this._system.emitters[0];
		this._emitter.emit();
		this._system.renderer = new Nebula.GPURenderer(this, THREE);
		this._system.addRenderer(this._system.renderer);
	});

Let me know if you want the Json data too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance Improvements
Thanks for 58 great years! All stores are now CLOSED. FINAL LIQUIDATION Auction of inventory, memorabilia and fixtures will take place in late...
Read more >
What is Performance Improvement? - BambooHR
Performance improvement is a strategy under the umbrella of performance management that helps employees achieve better performance and growth.
Read more >
Performance improvement - Wikipedia
Performance improvement is measuring the output of a particular business process or procedure, then modifying the process or procedure to increase the ...
Read more >
What Is Performance Improvement? - WalkMe
Performance improvement refers to the improvement of a business process, function, or procedure with the intention of improving overall outcomes ...
Read more >
How to Establish a Performance Improvement Plan - SHRM
A performance improvement plan (PIP), also known as a performance action plan, is a tool to give an employee with performance deficiencies the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found