Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
R5on11c10556yThat's actually pretty easy, Just write your code and only optimize / refactor under 2 circumstances:
1. The code needs to run faster
2. You have phases or specific times scheduled to refactor your code.
First functionality, then speed, then style. But you should use a linter of some kind tho. -
Just stop and don't optimize until the end, once you have identified all the major bottlenecks, after that you may fiddle with it all you want because either way the work will be done.
-
timourf976y@R5on11c The problem is, from my perspective, the code always needs to run faster. Your idea about scheduling time to rector and optimize is a good one, though.
I'm not sure I understand how a linter would help in this situation, though. Care to elaborate? -
py2js33776y@timourf understand and get away from premature optimisation. Learnt the hard way. If it's not needed then it's not worth it
Related Rants
-
vortexman10034Optimized my program fron running 74 minutes to running 0.005 seconds. I call that a successful day.
-
FMashiro14Yesterday I managed to optimize a query... Went from 43 seconds to 0.0702 seconds. For some reason mysql deci...
-
Teezha16First day at new web dev job: Me: what IDE do you guys use? Coworker: Notepad/notepad++ M: Okay... Any version...
Does any of you have the compulsion to micro-optimize every bit of code that you write? How do you deal with it?
I'm not just talking about algorithmic optimizations, but the real nitty gritty stuff. I'm talking about using bit fiddling to avoid if statements where speculative processors might make mispredictions. Anything that might make a program compile to fewer machine instructions or avoid extra stack frame overhead.
This all started a year ago when I took a systems programming course at my university, and started learning C and C++. But I find myself doing this in the wrong places. Who cares if this trivial program that I wrote runs in 1.2 or 0.6 seconds? My future employers won't care if my code is 10% more efficient when it takes four times as long to write.
It's gotten to the point that I can't bring myself to use languages like Python because I don't know how it's implemented under the hood and can't predict how the different ways I could write a function will affect performance. How do I bring myself to trust that the compilers (or interpreters) and the programmers that wrote them will be sufficiently optimal, and just move on? 😩
rant
gaaaaaaaah!
help me
optimization