|
|
|
|
|
by reitzensteinm
5125 days ago
|
|
You're definitely right about that. Probably the biggest inefficiency with all the ports is that they don't pool vectors. In the C++ version, vectors are often on the stack, which is way more efficient. In JS, it creates large numbers of temporary vectors that must be garbage collected. For my iPad port of one of my Flash games (written in Haxe, so it was actually being translated back into C++), I spent quite a few days profiling the places that were vectors were being created the most, and modifying them to use a pool. Then some verification code in debug mode checked that there was never a dead vector being written to or read from. In pathological places with tons of collisions, that got the speed from 2 fps to 30. |
|