You're unable to read via this Friend Link since it's expired. Learn more
Member-only story
Code Readability or Performance: Which Is More Important?
Analyze both sides to prioritize accordingly

The discussion around the importance of code readability compared to performance has been floating around on the internet for a long time. However, it is difficult to come up with an objective answer.
So let’s try to analyze readability and performance in different contexts instead of trying to find an objective answer.
Let’s start with a question: Is this readable code?
- .... .. ... / .. ... / .-. . .- -.. .- -... .-.. .
This is actually Morse code that translates to “this is readable!” You might say that this is readable if you know Morse Code. Now, does it make sense to call this code unreadable if you do not know Morse code? Not really, because it is readable Morse code.
Now let’s apply this to software. Can you figure out what the following code does by taking a quick glance at it?
This is actually an implementation of the bubble sort. If you know how bubble sort works and are used to writing algorithms like this, then you could probably figure it out in a quick glance. However, if you have never looked at the bubble sort algorithm before, you might take some time to figure this out.
Would you call this code unreadable just because it could take some extra time for people unfamiliar with the topic to understand it? This question brings us to our first point.
If the above algorithm intrigued you, then take a look at this detailed explanation and analysis of bubble sort by Vaidehi Joshi. I read this a while back and think it is an interesting read.