almutama / cakejs

Automatically exported from code.google.com/p/cakejs
0 stars 0 forks source link

Minimize allocations per frame #26

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Now there are a lot of arrays and other temp objects allocated per frame,
which is causing frequent pauses with Firefox 2's garbage collector. (No
idea about Fx3, its canvas is screwed up on my 64-bit Linux box.)

It would be rather dandy if we were able to avoid these pauses to the best
of our ability. In practice: avoid creating temp arrays and temp objects,
or use a global temp array allocator (heh, manual memory management.)

Experience with writing Librend (OpenGL scene graph in Ruby) would suggest
that the main problem is arrays, followed by unboxed floats. Can't really
do anything about the floats, so focus on arrays.

There are a couple of big (and easy?) culprits, namely
Curves.cubicPoint/cubicLengthPointAngle, and the SVD madness from dojo.

A JavaScript allocation profiler would really help: draw a frame, note how
many objects each function allocates.

Original issue reported on code.google.com by Ilmari.H...@gmail.com on 22 Mar 2008 at 2:04