Upload
cicada
View
22
Download
0
Embed Size (px)
DESCRIPTION
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 - PowerPoint PPT Presentation
LECTURE 37:LIES MY PROFESSOR TOLD ME
CSC 213 – Large Scale Programming
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?
212 163 153 143 133 123 113 103 930
100000
200000
300000
400000
500000
600000 Execution Time for pseudoJBB w/ 77MB Heap
GenCopyGenMS
Available Memory
Exec
utio
n Ti
me
(in s)
23.17x
62.73x
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 FIFO maintains blocks in Queue and evicts
oldest Track each use and evict block least
recently used (Randomly choose a 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?