80 likes | 164 Views
CSC 213 – Large Scale Programming. Lecture 37: Lies My Professor Told Me. Big-Oh uh-oh!. Big-Oh complexity not always accurate measure Makes several assumptions when used for analysis End results are valid only when assumptions hold Same cost using any memory in the computer
E N D
CSC 213 – Large Scale Programming Lecture 37:Lies My Professor Told Me
Big-Oh uh-oh! • Big-Oh complexity not always accurate measure • Makes several assumptions when used for analysis • End results are valid only when assumptions hold • Same cost using any memory in the computer • Makes big-On accurate when costs differ slightly • Minimizes total time when costs differ by a lot
Big-Oh uh-oh! • Big-Oh complexity not always accurate measure • Makes several assumptions when used for analysis • End results are valid only when assumptions hold • Same cost using any memory in the computer • Makes big-On accurate when costs differ slightly • Minimizes total time when costs differ by a lot !=
Big-Oh uh-oh! • Big-Oh complexity not always accurate measure • Makes several assumptions when used for analysis • End results are valid only when assumptions hold • Same cost using any memory in the computer • Makes big-On accurate when costs differ slightly • Minimizes total time when costs differ by a lot !=
Too Far For a Beer? 62.73x 23.17x
Maintaining Your Buzz • Prevent long pauses by maintaining locality • Repeatedly access those objects in fast memory • Access objects in sequential order they are in memory • Both of properties take advantage of caching • Limit data used to size of cache (temporal locality) • (Spatial locality) Exploit knowing how cache works • Limiting data is not easy (or would have done it) • So taking advantage of spatial locality is our best bet
Cache Replacement Algorithms • When we access memory, add its block to cache • May need to evict a block if the cache already full • 2+1 approaches used to select evicted block • FIFOmaintains blocks in Queue and evicts oldest • Track each use and evict block least recently used • (Randomlychoosea block to evict) • For good performance want to avoid worst case • But what is it?
For Next Lecture • Weekly assignments will be available tomorrow • None for this week, but will restart for final week • Program #3 test cases due on Wednesday • Does it work? Important to know this before going on • Portfolio due last day for both video or project • To submit video, must get script to me before then • Reading on (2,4)-trees for Wednesday • If we use trees, how can we improve locality? • Costs of this type of tree being used for Map?