Hacker News new | ask | show | jobs
by lebinh 4149 days ago
Measure and profile the code will always be the best thing to do but for simple 20% effort tips I think it would be:

* Don't write your own data structure, stick to the standard library or, in some rare cases, popular and well-known 3-rd party lib.

* Always prefer a Hash or a Set over anything else.

* Beware of any nested loops.

* Have some local / external caches and try memoization.

* Try parallelizing or better, non-blocking wait for all I/O operations.