7
TrayKnots
95d

I just realized that I subconsciously believe more lines of code means slower code.

It's not intellectual. I understand that little lines of code often are just calling other code. That this is not how Big O works or does not replace benchmarking and that some data structure requires a lot of code for immense speed up. E.g: B-Trees with sizes at page size for big amounts of data read from a secondary storage location.

But still, when I see a function with just 3 to 5 lines, my inner monkey believes it must be fast.

Know your biases, I guess.

Comments
  • 3
    more lines of code means it takes me longer to read the code so yes in a way

    this isn't a bias. I like concise code because it's faster to read it. also no abstractions except if absolutely necessary, because it's easier to read it

    you got the right intuition but the wrong target probably (computer instead of other humans)
  • 3
    XMLHttpRequest is definitely more responsive in async mode verses sync mode. Though the code is longer in async mode. Thought of this because I needed to use this to make a janky qml only test screen this week.
  • 3
    I also recently wrote extra code to make smth faster. It depends so much about what the lines do. Do they calculate? Use memory? Few factors.
Add Comment