Hacker News new | ask | show | jobs
by waps 4225 days ago
I find that when it comes to optimizing code with an emphasis on readability, the improvement is rarely only 5%. Plus the improvement is not just the end result's performance, but also in writing.

I think I don't understand this readability thing. I have trouble keeping the structure of large programs in my head. So for me, the number one readability property of a program is it's length. The shorter, the quicker I can read it.

For other people it seems to be a lot more about code they don't understand. List and dict comprehensions are one such thing, especially the iterator-based ones. Using variable capture with in-line functions is another, and God forbid I pass around a function pointer to an inner function, because it often lets me avoid writing an entire pointless class that I have to remember exists. I use functional programming constructs constantly where they make sense, which tends to be a lot of places. Why is all this forbidden ? Is this because people don't know what they do/how powerful these constructs can be ? I feel that rewriting a nested list comprehension into a 20 line function does absolutely nothing to clarify matters for me, it makes things worse.