Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Article: Resist the urge to optimize #101

Open
arnemertz opened this issue Apr 6, 2018 · 2 comments
Open

Article: Resist the urge to optimize #101

arnemertz opened this issue Apr 6, 2018 · 2 comments
Assignees
Labels

Comments

@arnemertz
Copy link
Member

Especially in languages that are supposed to be very performant, many developers tend to feel the need to write performant code. Code gets written in a specific way "because it's faster", usually coming with a number of problems:

  • Readability is sacrificed to the performance god and clean code principles are willfully or ignorantly violated. (reference to Article: Clean and cleaner code #59 )
  • It is not proven by a profiler that the code, written that way, is actually more performant. Instead, it is "known" from war stories and lore from the past that this is The Way Things Have to be Done ™️ (Reference to Article: Rules are Dangerous #31 )
  • It is not proven by a profiler that performance is actually needed at that point in the code.
  • While focusing on the low-level optimizations one may oversee that the overarching algorithm is not as effective as it could be.
  • Optimizers are actually prevented from doing their work because the code does not demonstrate well-known patterns that are recognized by the optimizer.

Bottom line:

  1. Write clean and maintainable code first
  2. Check your algorithms for efficiency
  3. Use benchmarking and profiling to show that and where optimizations are needed
  4. Only as a last resort apply manual optimizations, guided and verified by the profiler
@abeggchr
Copy link
Member

abeggchr commented Sep 4, 2018

Are you still working at Zühlke? I can't find you in the address book...

@arnemertz
Copy link
Member Author

I am, at the Hamburg office.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants