TIL Very Efficient Code
POSTED ON:
I absolutely love this:
via https://www.reddit.com/r/ProgrammerHumor/comments/10dh6x1/very_efficient_code/j4lm8eg?context=3
Why I like it #
This code is part of the Dutch DigiD App which is an authentication app for Dutch citizens to log in to government websites for taxes and other government related stuff.
It's O(1)
via sebbdk
at some point discovered that nitpicking isolated bad code only serves to suck the soul out of my juniors.
There are no awards for short code. Two types of coders would use this solution. Those who've written code for one month, and those who've done it for a lifetime. In-betweens can't resist over-engineering.
This is a great solution. Easy to understand. Executes really fast. No real-time string concatenation. No over-engineering. String appearance is easily customized.
Unless called 1000 times per second, there’s no reason for optimizing this further. It’s better to have readable code and spend time where it matters.
via Glitch29
It's EXTREMELY easy to read. It's easy to verify that there aren't any bugs. It's not that long. And while performance is unlikely to matter here, it runs faster than any solution which involves string operations.
Related TILs
Tagged: cleancode