HTML and CSS Reference
In-Depth Information
Figure 3-1. A lthough the demo uses WebGL, its coordinate system is the same as that of Canvas 2D
Object Pools
As discussed in the introduction, steady frame rate is definitely the goal, and you cannot have a steady frame rate if
your memory usage looks like what you see in Figure 3-2 .
Figure 3-2. Memory spikes in the particle system demo suggest that your games can benefit from an object pool
This illustration, taken from Chrome DevTools, displays the memory usage of the demo when spawning 60,000
objects per second, without turning on object recycling. You can see that the memory usage varies widely, from
30MB to 360MB.
If your game exhibits the same memory behavior, it may greatly benefit from an object pool. Use Chrome
DevTools, and check your memory timeline! You may also use the heap profiler, as well as the object allocation
tracker, to get a precise view of your memory usage. Refer to the Chrome DevTools documentation for how-tos and
up-to-date information.
Search WWH ::

Custom Search