3 ms·
It's not always the best way to write software. If you're writing a program that's supposed to work in real(ish) time then it's good to take performance into co
by kgabis 10y ago
It's not always the best way to write software. If you're writing a program that's supposed to work in real(ish) time then it's good to take performance into consideration early on, otherwise you'll end up rearchitecting your program later. It's not necessarily about a number of cycles each operation takes, but rather about memory layout of your data. I guess it's a matter of experience: if you expect something to be a bottle neck (because it was a bottleneck in a similar application you've written in the past) then maybe you should just write it properly the first time round?
- takeda 10y agoThat's why I mean when I said that the saying is abused. Some people think that choosing the right algorithm is premature optimization. It is not. Choosing whether to use malloc vs calloc is not an architectural change though, and in fact it is very easy to replace one with the other, but if you use the right call for right use case, then you will benefit from optimizations that the OS provides, and often you might not even be able to achieve them from user space.