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.

[SUGGESTION] Cache vertex-count of poly body for performance.

See original GitHub issue

In common ,

var len = arr.length;
for (var i=0;i<len;i++){ ...}

is faster than

for (var i=0;i<arr.length;i++){ ...}

Of course , In most cases , it’s not the performance hotspot . But in Physics Engine , it will be called so many times. And I see there are many for (var i = 0; i < vertices.length; i++) { will be called in one tick.

So I suggest that add a property vertexCount to body for caching the vertex-count. (like box2d)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
photonstormcommented, May 5, 2018

@bchevalier agreed, stuff like caching the array length is pointless with modern VMs and has been for years (unless you’re manipulating the array size within the loop of course!)

0reactions
liabrucommented, May 6, 2018

Agreed with the above and in general micro-optimisations tend to be bad practice in most cases, unless the effect can be proven to be consistently large. I much prefer algorithmic improvements! Thanks for the suggestion though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poly count for character? - Unity Forum
This is a tech test for you to find your optimal result in performance and not for having the best visual result (yet)....
Read more >
MultiRes Modifier | 3ds Max 2021
The MultiRes modifier reduces the memory overhead needed to render models by decreasing the number of vertices and polygons.
Read more >
Volume 2d: Command Reference: Structures - 01.org
from course of performance, course of dealing, or usage in trade. ... Slot Group Select Render Cache Message Descriptor Control Field .
Read more >
Vertex Animation Textures ROP 2.0 Released | Forums - SideFX
I've been investigating different cache ways to bring in animation into unreal so I've had an eye on animation textures for a while....
Read more >
A Java Stream Computational Model for Big Data Processing
CacheStream for accessing Oracle Coherence; and Java. 8 Stream Collector implementations, ... body consisting of a single expression or a statement block.
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