Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm interested in learning more about how to optimize JavaScript programs. Do you know of any good examples or other resources in this area?


nothing specific, just do a google search.

generally i think advice that will always be applicable:

- learn and use a profiler before there are performance issues, not after (dont treat performance as an afterthought).

- internalize which patterns are faster and which are slower, and when it matters.

- for any runtime with a GC, reduce repetitive memory allocation and GC pressure. prefer shallow structures. mutation instead of immutability (thus, mem allocation).

- cache/memoize whenever possible.

- don't use algorithms that scale poorly with data size.

finally, beware of following any performance advice older than 6 months; JITs advance constantly, so make sure to re-bench/measure continuously to avoid doing unnecessary refactors, and test with real code; there are lies, damned lies, and micro-benchmarks.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: