Comments (4)
I ran that benchmark on this machine (ubuntu with a crappy gfx driver, but fast cpu and lots of ram) and closure was the clear winner except for rotation (where TDL did better) and transpose (where CanvasMatrix did better).
So if you make this change, be sure to test it very well, since I think it'd be a pretty big drop in readability.
from chipmunk-js.
glMatrix doesn't just use arrays. It uses typed arrays (Float32Array).
When I ported cpVect I did some simple benchmarks on jsperf to try and pick the right data structure for vectors - IIRC it wasn't really any faster using arrays. But there's no need to speculate. Hop on jsperf.com and run the experiment.
from chipmunk-js.
Oh, and there was a decent (~20% iirc) speedup from making a lot of the 'hot' vectors inline (body.vx, body.vy) instead of body.v.x and body.v.y. They're faster to access and you put less load on the GC. Because javascript is duck typed, you can just pass the body in directly to any of the vector functions.
If we swap to arrays, we lose that little optimization.
from chipmunk-js.
Oh, interesting... in Firefox (x86-64) glMatrix wins and the others yield a lot of 'bad' results, but it stinks in Android Firefox 16-beta (which does support typed arrays). Closure and tdl.fast have a slight edge in Chrome; all three are Google's, surprise surprise. All those matrix libs except glMatrix are 2x-10x faster in Chrome, too. Google's engineers probably figured out how to make regular arrays as fast as typed arrays, just within the past year.
Thanks for the feedback.. glad I asked. I'll close this issue now :)
from chipmunk-js.
Related Issues (20)
- regarding Collision Callback HOT 4
- Does not pass google closure advanced mode HOT 4
- Implement segment collision detection HOT 2
- Emscripten HOT 11
- Probably wrong context in SpatialIndex.prototype.collideStatic HOT 4
- Typescript Type Definitions? HOT 4
- jerky player movement HOT 7
- Performance boost 10-16% HOT 2
- Bug in Node js HOT 2
- Could you add a Demo branch that can access via Github HOT 2
- Old engine (node 0.6.5)
- Cannot move static bodies.
- BBTree 'count' property overrides 'count' method
- RotaryLimitJoint.prototype.getImpulse is missing the 'joint' argument
- NoCollide collides. HOT 3
- Demo link off
- Cannot create a body
- Body.applyForce is mis-implemented as Body.applyImpulse
- Native JS Bindings for Chipmunk HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chipmunk-js.