Tom Cargill 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.

Slides:



Advertisements
Similar presentations
Foundational Certified Code in a Metalogical Framework Karl Crary and Susmit Sarkar Carnegie Mellon University.
Advertisements

Performance What differences do we see in performance? Almost all computers operate correctly (within reason) Most computers implement useful operations.
CS2100 Computer Organisation Performance (AY2014/2015) Semester 2.
Computer Abstractions and Technology
Intro to CIT 594
Chapter 1: An Overview of Computers and Programming Languages
Mixed Recursion: Sec. 8.4 Exercise 3. The closed-form formula for the Towers of Hanoi problem, M n = 2 n – 1, can be proved by mathematical induction.
Java.  Java is an object-oriented programming language.  Java is important to us because Android programming uses Java.  However, Java is much more.
Planning under Uncertainty
Computer Science II Recursion Professor: Evan Korth New York University.
June 13, Introduction to CS II Data Structures Hongwei Xi Comp. Sci. Dept. Boston University.
System Design and Analysis
Computer Science - I Course Introduction Computer Science Department Boston College Hao Jiang.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
CS 206 Introduction to Computer Science II 12 / 10 / 2008 Instructor: Michael Eckmann.
Fall 2001CS 4471 Chapter 2: Performance CS 447 Jason Bakos.
Schedule Midterm out tomorrow, due by next Monday Final during finals week Project updates next week.
Computer Science - I Course Introduction Computer Science Department Boston College Hao Jiang.
Prof. Fateman CS 164 Lecture 161 Properly Tail Recursive Interpreter. Some timings of compilation vs interpretation Lecture 16.
July 16, Introduction to CS II Data Structures Hongwei Xi Comp. Sci. Dept. Boston University.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages Updated by: Dr\Ali-Alnajjar.
Your Interactive Guide to the Digital World Discovering Computers 2012.
CSC 313 – Advanced Programming Topics. Why Recurse?  Recursion is useful, powerful technique  Often yields compact, easy-to-read code  Highlights all.
Introduction to Systems Analysis and Design Trisha Cummings.
Chocolate Bar! luqili. Milestone 3 Speed 11% of final mark 7%: path quality and speed –Some cleverness required for full marks –Implement some A* techniques.
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
CSCA48 Course Summary.
CSC 212 – Data Structures Prof. Matthew Hertz WTC 207D /
Assembly Questions תרגול 12.
Adaptive Optimization in the Jalapeño JVM Matthew Arnold Stephen Fink David Grove Michael Hind Peter F. Sweeney Source: UIUC.
1 Time Analysis Analyzing an algorithm = estimating the resources it requires. Time How long will it take to execute? Impossible to find exact value Depends.
Computer Science 313 – Advanced Programming Topics.
Goals: To gain an understanding of assembly To get your hands dirty in GDB.
Computer Science and Software Engineering University of Wisconsin - Platteville 9. Recursion Yan Shi CS/SE 2630 Lecture Notes Partially adopted from C++
Lecture Topics: 11/17 Page tables TLBs Virtual memory flat page tables
The Physics of Computer Science By Matthew Pinney A Brief look at how physics is related to Computer Science and a sample application of problem solution.
Computer Science 313 – Advanced Programming Topics.
Moving Around in Scratch The Basics… -You do want to have Scratch open as you will be creating a program. -Follow the instructions and if you have questions.
Compiled by Maria Ramila Jimenez
Computer Science 313 – Advanced Programming Topics.
Computer Science 313 – Advanced Programming Topics.
CSC 212 – Data Structures Lecture 37: Course Review.
CS 3500 L Performance l Code Complete 2 – Chapters 25/26 and Chapter 7 of K&P l Compare today to 44 years ago – The Burroughs B1700 – circa 1974.
CSC 313 – Advanced Programming Topics. Observer Pattern in Java  Java ♥ Observer Pattern & uses everywhere  Find pattern in JButton & ActionListener.
Performance Analysis & Code Profiling It’s 2:00AM -- do you know where your program counter is?
Intro to CIT 594
1  1998 Morgan Kaufmann Publishers How to measure, report, and summarize performance (suorituskyky, tehokkuus)? What factors determine the performance.
1 Performance Issues CIS*2450 Advanced Programming Concepts.
Searching Topics Sequential Search Binary Search.
EGRE 426 Computer Organization and Design Chapter 4.
Eagleson’s Law: Any code of your own that you haven't looked at for 6+ months might as well have been written by someone else.
CMSC 611: Advanced Computer Architecture Performance & Benchmarks Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some.
Compilers and Interpreters
July 10, 2016ISA's, Compilers, and Assembly1 CS232 roadmap In the first 3 quarters of the class, we have covered 1.Understanding the relationship between.
CS 302 Data Structures Algorithm Efficiency.
Advanced Computer Systems
Measuring Where CPU Time Goes
Introduction to Recursion
What to do when a test fails
Application Development Theory
CS2100 Computer Organisation
2008/12/03: Lecture 20 CMSC 104, Section 0101 John Y. Park
Introduction to Systems Analysis and Design
Introduction to CS II Data Structures
Min Heap Update E.g. remove smallest item 1. Pop off top (smallest) 3
Yan Shi CS/SE 2630 Lecture Notes
Shared memory programming
Chapter 2: Performance CS 447 Jason Bakos Fall 2001 CS 447.
CS2100 Computer Organisation
Presentation transcript:

Tom Cargill 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.

Computer Science 313 – Advanced Programming Topics

Tom Cargill 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.

Let’s Get Coding  Who will write next lab in assembly?  Write entire program in assembly  Apply standard optimizations for first pass  Finally, hand tune every method & every class  Necessary to achieve top performance pushl %ebp movl %esp, %ebp subl $24, %esp movl 8(%ebp), %eax movl %eax, -4(%ebp) cmpl $0, -4(%ebp)

 Programs just λ-calculus equations  Can use this to prove program correct  Translate program into λ-calculus  Specify and prove program correctness theorem  What if I guarantee student an A? Promise of Perfect Debugging

Why Isn’t This Done?  Almost never use these techniques  Even device drivers not entirely in assembly  Rare to develop even partial proof of correctness  Perform a cost-benefit analysis  Techniques requires massive amounts of time  Time is money; these are very, very expensive  Simply not worth the benefits provided

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

Problem is Universal  Making optimal decisions occurs frequently  Using reagents during chemical synthesis  When to perform maintenance on power plant  Which ski lift line will be fastest  Cannot optimize everything  Must focus on where it matters most But how can I know what is important?

Are Graphics Important?  Rewrite Swing to improve its performance? Hells, yes. We need the 30 fps gamers demand. Hells, no. What does it do for search speed?

Critical Paths  Only consider code along critical path  Process which determines time required  Graphics are not critical for Google  Could dramatically improve graphics…  …but would not effect how long search takes  Bungie’s critical path is graphics package  Graphics limits program performance  No impact from improvements to file searching

Guess the Critical Path $ java -Xprof edu.canisius.ann.Network Flat profile of 16.4 secs (956 total ticks): main Compiled + native Method 35.6% Neuron.getWeightedError 21.1% Neuron.updateWeights 13.0% Network.trainNetwork 9.5% java.lang.StrictMath.exp 9.5% Neuron.compute 4.5% Network.setNetworkInput 3.6% Network.runOneInput 2.0% java.util.ArrayList. 0.8% Network.main 99.6% Total compiled

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

Amdahl’s Law  Determines how much faster program can go  Can finally answer the question that matters  Equation’s result is program speedup  Speedup of 2 when program twice as fast  Program runs in 1 / 10 the time, then speedup is 10  Execution time unchanged with speedup of 1  Needs twice as long when speedup is ½

Amdahl’s Law Equation

Applying Amdahl’s Law  Made getWeightedError twice as fast  Speedup changed = 2, since now twice as fast  Took 16.4 seconds before, what will it take now?  Get execution times from java –Xprof 35.6% Neuron.getWeightedError %changed = %unchanged = = 0.644

Amdahl’s Law Speedup = 1.21

Applying Amdahl’s Law  Move Neuron.compute off critical path?  Removes it from program execution time  Speedup changed = ∞  Get execution times from java –Xprof 9.5% Neuron.compute %changed = %unchanged = = 0.905

Amdahl’s Law Speedup = 1.10

For Next Class  Lab #4 on web/Angel & due before next lab  Midterm #1 in class on Monday  Will be open-note, open-book, & open-reports  But closed-friend, closed-slide, & closed-activity  Most questions resemble in-class activities  Could also ask to implement design pattern  Use design patterns to develop solution to sample problem

Midterm Preparation  When/where to use a design pattern  Determine pattern used by real-world example  Understand what the design principles mean  Explain how a design pattern follows a principle  Convert method to be tail recursive  Make tail recursive method iterative  Use Stack to eliminate recursion from method  Compute speedup using Amdahl’s law  Use speedup to determine new execution time