DOC PREVIEW
UW CSE 303 - Lecture Notes

This preview shows page 1-2 out of 7 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

bash today, C tomorrowDebuggingPerformanceAlgorithmic complexitySlide 5Performance: one more thingQuestions?David Notkin  Autumn 2009  CSE303 Lecture 7bash today, C tomorrow•Quick reprise: debugging, performance•What’s homework 2B? (yes, it’s posted)•Some looks at solutions to 2ADebugging•“Debugging is important, especially since the shell is so sensitive to details. I recommend two things: (a) trying your commands individually in the command-line as you're trying to build your shell scripts; and (b) assigning and echoing ‘unnecessary’ variables in your scripts that can be used to help see what's happening step-by-step.”•When things don’t work, what do you do?CSE303 Au09 2Performance•I'm not worried about performance (within a little bit of reason) on 2A. Bill Wulf, who served as president of the National Academy of Engineering for over a decade, once said something like: “More mistakes are made by premature optimization than for any other reason including sheer ignorance.”–OK, maybe it doesn’t work right, but at least it’s really fast. –Well, if it doesn’t have to work right, I can make it even faster!CSE303 Au09 3Algorithmic complexity•When dealing with a lot of data, what is usually most important about performance is the underlying algorithmic complexity–Very roughly, how many times do you need to touch each data item•Examples–Finding a number in an unsorted list: linear search–Finding a number in a sorted list: linear or binary search–Sorting a list: O(N2) vs. O(N log N)•HW2: if you touch every entry in the dictionary many times for each input string, that might be a problem – there are 479,829 entriesCSE303 Au09 4CSE303 Au09 5http://www.cs.bath.ac.uk/~jjb/here/CM10135/CM10135_Lecture3_2004.htmlPerformance: one more thing•Once you get the algorithmic complexity “right”, there can still be many ways to improve performance•A classic example is that some arithmetic operations are faster to execute than others but are equivalent–x*2 vs. x+x–vs. left-shift x•001101010 => 011010100 [106*2= 212]•Another classic example is that some operations are faster than others to execute – for example, creating (“forking”) a new process in Unix is generally more expensive than computing in the same process•These, however, require some actual knowledge about the costs factors you face – without that (or at least significant experience), you’re likely to guess wrong about what is costlyCSE303 Au09 6Questions?CSE303 Au09


View Full Document

UW CSE 303 - Lecture Notes

Documents in this Course
Profiling

Profiling

11 pages

Profiling

Profiling

22 pages

Profiling

Profiling

11 pages

Testing

Testing

12 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?