4 ms·
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, sti
by lebinh 12y 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.