Object pools in high performance javascript?

前端 未结 5 1244
别跟我提以往
别跟我提以往 2021-01-29 21:53

I\'m writing some javascript code which needs to run fast, and uses a lot of short-lived objects. Am I better off using an object pool, or just creating objects as I need them?<

5条回答
  •  日久生厌
    2021-01-29 22:00

    Object pooling may help, especially if you are churning through a lot of objects. I recently wrote an article on this very subject which might be worth a read.

    http://buildnewgames.com/garbage-collector-friendly-code/

提交回复
热议问题