What are the limits to pushing JavaScript performance?

后端 未结 3 854
时光说笑
时光说笑 2021-01-03 12:14

I have been building a prototype page over the past few months that uses a lot of SVG and has a lot of elements in general. There is also a ton of data being processed both

3条回答
  •  孤独总比滥情好
    2021-01-03 12:53

    There are no limits that are written in stone.

    What can be done on my computer versus the machine I look up recipes on versus my 4 year olds netbook will differ. Memory, speed, etc depends on the browser, cpu, ram, and what else is running on the machine. I bet you run your code on some other platforms and it will freeze and you would have to do the 3 finger salute to kill the process.

    • Do smart event handling, detect clicks at lower levels, not on every element.
    • Push as much as you can on the server for intensive processing.
    • Optimize code, make sure you are not updating the screen on every iteration of a loop.
    • Combine/minimize http requests when possible.

提交回复
热议问题