Closed issy123 closed 6 years ago
Do you have benchmarks to show the "Huuuge performance improvement"? I'm curious what the actual change is.
@englercj I have done multiple cpuprofile samples of my game and just modified the ones with the most computation time to be more performant.
I don't really have benchmarks in terms of facts, but in my game (without changing my own game code ofcourse) before i could spawn 100 circles/boxes & sensors with 80-100% cpu usage. After i could spawn 1000 circles/boxes & sensors with 70-90% CPU usage.
But those are not really things that proofs it, just talk of a random guy.
If you can run benchmarks i would love to see them!! :) You can see the changes in the commit.
I like this PR. There are many denseness computations in a physics engine , I think we shouldn't despise any micro-optimization . In particular,when we use JS and run it on mobile device.
@englercj
also I have changed the code you contributed, it may be fast for FF but not for the v8 engine (webkit browsers & nodejs) the change i made is in experience a more efficient one.
https://github.com/schteppe/p2.js/commit/3879c0194ba91a6cb37bb056f9e6893b9d9688bd
@issy123 I'm sure the browser landscape has changed in the past 3 years but that change was originally to increase performance and not increase GC. I specifically didn't want to allocate a new object each reset.
I also stand by what I said before: benchmarks prove performance increases, otherwise we are just guessing.
@englercj do you have anything you can suggest to benchmark with?
Is this something you can work with?
So just like the unit tests in test/ folder i can make a benchmark/ folder and u only have to type grunt benchmark
? just like you type grunt test
The results are similar to jsperf.
benchmark.js
is the standard, most other js things wrap it (including jsperf).
Changes:
array.length
.indexOf()