Programming Languages Performance Patterns Macros Zach Tatlock Spring 2014 When I was a novice programmer I spent many hours trying to speed up my code One day after many agonizing attempts at this feat my ID: 605649
Download Presentation The PPT/PDF document "CSE 341" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
CSE 341 Programming Languages Performance Patterns, Macros
Zach TatlockSpring 2014Slide2
When I was a novice programmer, I spent many hours trying to "speed up" my code. One day, after many agonizing attempts at this feat, my mentor approached
and asked how things were going. Upon hearing of my troubles, he imparted this sage wisdom:
"The CPU," he said, "runs at a certain speed. It can execute a fixed number of
instructions per second, and no more. There is a finite limit to
how many
instructions per second it can execute
.”
"So there is no way, really, to make code go faster, because there is
no way
to make instructions execute faster. There is only such a thing
as making
the machine do less."
He paused for emphasis.
"To go fast," he said slowly, "do less."Slide3
OptimizationThe 1st rule of optimization:
Don’t do it.The 2nd rule of optimization(experts only)
: Don’t do it
… yet.Slide4
OptimizationSeriously, only optimize with profile in hand.Otherwise, two very nasty consequences:
1. time wasted - life is short! 2. code unnecessarily complex
- need more beauty in the world
YOLO