3 ms·
but I don't know enough to make it fast I'd say that in the vast majority of cases, you don't actually need to; what you need to instead focus on is how to mak
by userbinator 4y ago
but I don't know enough to make it fast
I'd say that in the vast majority of cases, you don't actually need to; what you need to instead focus on is how to make it not slow, and to do so is really not that difficult. In a word, it's (total) simplicity. The less code there is in total that the CPU has to execute, the faster it'll be. Thus, don't add unnecessary abstractions/indirections unless necessary, pull in huge libraries and use a tiny fraction of their functionality, etc.
I'm of the opinion that you don't need to know about cycle counting and such to write decently efficient software. You don't need to specifically optimise if you start off with a sane and simple design.
- culi 4y ago> The less code there is in total that the CPU has to execute, the faster it'll be. The more higher-level the language is, the less this is true in my experience
- Too 4y agoSimplicity is good but often not the solution to make things faster. Most obvious example. Binary search is faster than linear, at the cost of more complexity (that can often be hidden under an abstraction). Async code is often perceived as faster than synchronous, at the cost of more complexity. In the case of TFA, loading the file list asynchronously in the background could have been a good candidate for such.
- laundermaf 4y ago> focus on is how to make it not slow That's the same thing, worded differently. A junior programmer might focus on looping for-loops backwards "for speed" and then leave a serial `await` in the loop itself. If you don't see that that's a problem, no "focus" will help.