you are viewing a single comment's thread
view the rest of the comments
[–] 8 points 11 months ago (3 children)
  • The fastest code is the code you don't run.

Not really. The code can be slow, even if I do not run it. Also, sometimes additional code can do optimization (like caching), which is more code = faster. Or additional libraries, complexity and code paths can in example add multicore execution, which could speed up. So, I do not buy the less code is faster logic.

  • source
  • hideshow 3 child comments
  • [–] 9 points 11 months ago (1 child)

    I think it really depends on what your code is doing. I do agree that less isn't always faster or as they mentioned in the post, safer. Taking a raw input is fast, but not very safe for a variety of reasons. I personally make "simple to understand" as the highest priority for my code.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 11 months ago

    On a slightly different example, the suckless project has a huge emphasizes on lightweight code, which they call "suckless". I don't think in this case faster is the goal, but having less code and be simple as possible (not even configuration files allowed, you just recompile program) and almost no documentation in the code either. But the idea is the same, of having "lightweight" code.

  • source
  • parent
  • [–] 8 points 11 months ago

    I think the most obvious example is loop unrolling. An unrolled loop can be many times more code, but runs faster because you're not updating a counter or doing conditional jumps.

  • source
  • parent