Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildTree's performances improvement #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fungiboletus
Copy link
Contributor

This patch should improve buildTree's performances.

I made sorting methods comparisons here : http://jsperf.com/sort-comparaison-function and I choose the best one for Chrome/Firefox/iPad/IE

It's not perfect, a limitation is that the dimensions array should be a list of words (you can's use "{a *-" as key). But the performances gain is worth.

@fungiboletus
Copy link
Contributor Author

It's not very scientific, but this is an example with 10000 points, 20 balls and 1 neighbour search. The tree is rebuilt at each frame.

Left : with the patch (on Chrome)

Screen capture

@factoidforrest
Copy link

Nice! Thank you

@aemkei
Copy link
Member

aemkei commented Dec 19, 2013

Not sure, if we should merge this into the main repository. When I run the test using Chrome 31, the classic comparison gives me the best results.

@fungiboletus
Copy link
Contributor Author

Yes, the classic one is in the test as indication. It's the most efficient in Chrome, Safari iOS (and IE8) because the key is hardcoded and the javascript engine can optimize it very well. «Classic reborn» is the best in Firefox, Firefox OS and IE11.

Your master branch is currently using the «dynamic key» comparison method. You can't hardcode the key because it is given in the constructor arguments.

When I made the test, I started with the «classic» and the «dynamic». Then, I managed to have a dynamic method with performances close to the classic method.

@fungiboletus
Copy link
Contributor Author

And I don't know why, the browserscope system doesn't work. So this my results, I tried everything I found :

Chrome 31

  • Classic 52 ops/sec
  • Dynamic 25 ops/sec
  • Patch version 40 ops/s

Firefox 26

  • Classic reborn 115 ops/sec
  • Dynamic 95 ops/sec
  • Patch version 110 ops/s

Internet Explorer 11

  • Classic reborn 67 ops/sec
  • Dynamic 6 ops/sec 🐌
  • Patch version 66 ops/s

Safari iOS - iPad

  • Classic around 40 ops/sec
  • don't remember, it was similar to Chrome, so 20 ops/s maybe
  • Patch version 35 ops/s

Firefox OS on ZTE Open 😴

  • Classic reborn 0.68 ops/sec
  • Dynamic 0.4 ops/sec
  • Patch version 0.68 ops/s

Chrome Android

  • Classic reborn 4.24 ops/sec
  • Dynamic 2.56 ops/sec
  • Patch version 4.21 ops/s

Safari iOS is very fast compared to other ARM browsers (the difference between the zte and the android tablet is related to the hardware).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants