[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Number allocations aren't the same as allocating mutable objects. If you do it in JS the VMs will happily deal with immutables of determined type in a fairly efficient GC free manner. If you do it in native code, then there won't be any objects for them at all, they'll be native types, read out directly from the array backing store. The temporary I mean is what happens when you call "new MyMatrix" or start chaining things like rotate().translate().skew() etc.
If you do any of the following in JS (or by equivalent ref/derefing native code):
- new something()
You will get a GCed object, which will need collecting, which will pause JS for anything between 60ms up to 200ms, which will make your smooth 60fps requestAnimationFrame skip over anything around 4 to 20 frames, which you will see as jittery animation. To be completely free of this effect you will have to guarantee that the GC is going to complete its job at most in one millisecond per frame (assuming you've got one or two other things to do than GCing per frame). This will never be the case.