11 ms·
My rule of thumb : never optimize your code, instead optimize your algorithm as much as you can. After you finish, you can profile your code to see where you ma
by 0xFFC 10y ago
My rule of thumb : never optimize your code, instead optimize your algorithm as much as you can. After you finish, you can profile your code to see where you made mistake.
- hellofunk 10y agoPerfect advice. Most bottlenecks are not because of coding details, but algorithmic or architectural concerns.
- kgabis 10y agoIt's hard to optimize your code if you made bad decisions about memory layout of your data structures in the past.
- paulddraper 10y agoAlgorithm optimizations can be far less readable than other kinds. Matrix multiplication is super simple. Strassen is more complicated. Coppersmith–Winograd is brain bending (besides being slower on actual data and hardware). The rule of thumb is: you have a complexity budget and a performance budget. Know what they should be, and choose economically.