1 / 29

Lecture 5: 90-10 Rule

Computer Science 313 – Advanced Programming Topics. Lecture 5: 90-10 Rule. The first 90% of the code accounts for the first 90% of the development time . The remaining 10% of the code accounts for the other 90% of the development time. Tom Cargill. Let’s Get Coding.

alessa
Download Presentation

Lecture 5: 90-10 Rule

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Science 313 – Advanced Programming Topics Lecture 5:90-10 Rule

  2. The first 90% of the code accounts for thefirst 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. Tom Cargill

  3. Let’s Get Coding • Who will write next lab in assembly? • Can only use assembly code for entire lab pushl %ebpmovl %esp, %ebpsubl $24, %espmovl 8(%ebp), %eaxmovl %eax, -4(%ebp) cmpl $0, -4(%ebp)

  4. Let’s Get Coding • Who will write next lab in assembly? • Can only use assembly code for entire lab • During the first pass, apply standard optimizations pushl %ebpmovl %esp, %ebpsubl $24, %espmovl 8(%ebp), %eaxmovl %eax, -4(%ebp) cmpl $0, -4(%ebp)

  5. Let’s Get Coding • Who will write next lab in assembly? • Can only use assembly code for entire lab • During the first pass, apply standard optimizations • Every method should be tuned to maximize branches pushl %ebpmovl %esp, %ebpsubl $24, %espmovl 8(%ebp), %eaxmovl %eax, -4(%ebp) cmpl $0, -4(%ebp)

  6. Let’s Get Coding • Who will write next lab in assembly? • Can only use assembly code for entire lab • During the first pass, apply standard optimizations • Every method should be tuned to maximize branches • Necessary to achieve top performance pushl %ebpmovl %esp, %ebpsubl $24, %espmovl 8(%ebp), %eaxmovl %eax, -4(%ebp) cmpl $0, -4(%ebp)

  7. Promise of Perfect Debugging • Programs just λ-calculus equations • Use Java, but instead prove program correct • Translate program into λ-calculus • Specify theorem & prove program correctness

  8. Fewest Lectures Ever • What if guaranteed A for student doing this? • Would still need to submit assignment on time • Working assembly needed (with optimizations) • Code should work, but proof must be perfect • Any takers?

  9. Fewest Lectures Ever • What if guaranteed A for student doing this? • Would still need to submit assignment on time • Working assembly needed (with optimizations) • Code should work, but proof must be perfect • Any takers? Why not?

  10. Why Isn’t This Done? • Almost never use these techniques • Low-level device drivers use some C (or similar) • Rare for partial proof of correctness to be used • Simple result from easy cost-benefit analysis • Techniques requires massive amounts of time • Time is money; these are very, very expensive • The provided benefits just not worth it

  11. What’s The Secret? How do I know when to optimize? I need to know. Please, please, please?

  12. Problem is Universal • Frequent need to make optimal decision • Using reagents during chemical synthesis • Take power plant offline & perform maintenance • Fastest torrent from which to download • Cannot optimize everything • Instead we only focus efforts where it matters

  13. Problem is Universal But how can I know what is important? • Frequent need to make optimal decision • Using reagents during chemical synthesis • Take power plant offline & perform maintenance • Fastest torrent from which to download • Cannot optimize everything • Instead we only focus efforts where it matters

  14. Are Graphics Important? • Rewrite Swing to improve its performance?

  15. Are Graphics Important? • Rewrite Swing to improve its performance? Hells, yes.We need 60 fps for new games.

  16. Are Graphics Important? • Rewrite Swing to improve its performance? Hells, yes.We need 60 fps for new games. %#$ no. What does it do for search speed?

  17. Critical Paths • All that is important is code along critical path • Determines time needed and not just the fluff • Graphics are not critical for Google • Major graphics improvements are nice… • …but have zero affect on search times • Bungie’s critical path is graphics package • Games performance limited by graphic times • Would hate GPU for search – slows them down

  18. Guess the Critical Path $ java -Xprofedu.canisius.ann.Network Flat profile of 16.4 secs (956 total ticks): main Compiled + native Method 35.6% 282 + 58 Neuron.getWeightedError21.1% 187 + 15 Neuron.updateWeights13.0% 124 + 0 Network.trainNetwork 9.5% 0 + 91 java.lang.StrictMath.exp 9.5% 91 + 0 Neuron.compute 4.5% 22 + 21 Network.setNetworkInput 3.6% 34 + 0 Network.runOneInput 2.0% 0 + 19 java.util.ArrayList.<init> 0.8% 8 + 0 Network.main99.6% 748 + 204 Total compiled

  19. Still a Cost-Benefit Trade Great. More useless geekery.When will it make a difference? When is it worth my time?

  20. Amdahl’s Law • Determines how much faster program can go • Use this to answer question that matters • Speedup calculated by this equation • Speedup of 2 means program twice as fast • Need 1/10 the time, 10 is speedup factor of approach • When speedup is 1, time taken unchanged • Speedup of ½ == twice as long as past approach

  21. Amdahl’s Law • Determines how much faster program can go • Use this to answer question that matters • Speedup calculated by this equation • Speedup of 2 means program twice as fast • Need 1/10 the time, 10 is speedup factor of approach • When speedup is 1, time taken unchanged • Speedup of ½ == twice as long as past approach(But usually say slowdown factor of 2)

  22. Amdahl’s Law • Determines how much faster program can go • Use this to answer question that matters • Speedup calculated by this equation • Speedup of 2 means program twice as fast • Need 1/10 the time, 10 is speedup factor of approach • When speedup is 1, time taken unchanged • Speedup of ½ == twice as long as past approach(But usually say slowdown factor of 2)(Or hide report that shows this sucks)

  23. Amdahl’s Law Equation • %changed of time in methods to be optimized • Expressed as decimal between 0 - 1 • All other time from run is %unchanged • Another decimal from 0 – 1 • If %changed + %unchanged ≠ 1,you FAIL

  24. Applying Amdahl’s Law • Made getWeightedErrortwice as fast • Speedupchanged = 2, since now twice as fast • Took 16.4 seconds before, what will it take now? • Get execution times using java –Xprof 35.6% 282 + 58 Neuron.getWeightedError%changed = 0.356%unchanged = 1 - 0.356 = 0.644

  25. Amdahl’s Law Speedup = 1.21

  26. Applying Amdahl’s Law • Move Neuron.computeoff critical path? • Removes it from program execution time • Speedupchanged = ∞ • Get execution times from java –Xprof 9.5%91 + 0 Neuron.compute%changed = 0.095%unchanged = 1 - 0.095 = 0.905

  27. Amdahl’s Law Speedup = 1.10

  28. What Amdahl’s Law Means

  29. For Next Class • Lab #2 on web/Angel in 1 hour • I will be in lab from 12 - 1 – feel free to stop by • Read pages 37 – 55 in book • Get back into code & design patterns • How could we handle 1-to-many communication? • Why not have cycles in UML class diagram? • What is secret to Lindsay Lohan'ssuccess?

More Related