Long intro
My first real post on dev.to, in September 2017, was the following:
Adventures in Tra...
For further actions, you may consider blocking this person and/or reporting abuse
This phrase was used when this article was tweeted. And I thought: "Wait, does it mean he was fired?!" 🤣
I just logged in to like this XD
hahaha like the whole concept of automating yourself out of your job :D
Excellent write-up :) It's nice to explorative programming leading to such cost-effective solutions.
I do have a small quibble with the title, which you already touch upon in your second paragraph: it should be 'performance can matter'. Because under the more general statement also fall things like pointlessly dense one-liners and writing scripts to save 10 seconds of typing per day.
Ah ah true :-) Saving 10 seconds is probably a stretch too far in the performance category but I see what you mean.
I have to honest: I'm not totally against dense one liners if they actually increase performance (after careful benchmarking), provided that they are well documented and hopefully isolated from the rest of the code.
That's where 'fast enough' comes in: if it takes you a minute to read the documentation, another minute or two to mentally parse the code and 15 minutes of carefully checking your changes, and perhaps 2 days debugging to notice what is actually wrong, then what point is a 2 ms speedup for something that likely has no gain from that speedup? (Which is far too common an occurrence)
Or more concisely: too many people have wasted too many hours due someone who felt a need to be clever.
There are of course plenty of situations where performance is really needed. And there it's worth investing the time to do benchmarking and properly document the code. But most of the time, I'd be grateful if code were maintainable rather than clever.
I totally agree with you, only a comment:
Well yes, if the speed up of the oneliner is 2ms then no, it's definitely not worth it. The only upside in your case is that you might have gain a better knowledge of the system but that's due to the 2 days of debugging, not due to the oneliner :D
Indeed :-)
This reminds me of a talk where, if I recall, a Python reporting process was sped up by first improving the algorithm, then compiling with Cython:
Maybe this experiment can benefit if compiled in cython 🤔
Maybe, it really depends on the code
One thing that would fit your 'stuff to think about...' list nicely is 'always choose the right tool for the job'. But then again I think everybody knows that one by now
You're right
I wouldn't bet on it, we're lazy animals of habit after all
Rust's bat is sick though.
Yeah! Rust FTW I guess