lecture 37: lies my professor told me

8
LECTURE 37: LIES MY PROFESSOR TOLD ME CSC 213 – Large Scale Programming

Upload: cicada

Post on 24-Feb-2016

22 views

Category:

Documents


0 download

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

TRANSCRIPT

Page 1: Lecture 37: Lies My Professor Told Me

LECTURE 37:LIES MY PROFESSOR TOLD ME

CSC 213 – Large Scale Programming

Page 2: 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

Page 3: 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

!=

Page 4: 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

!=

Page 5: Lecture 37: Lies My Professor Told Me

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

Page 6: Lecture 37: Lies My Professor Told Me

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

Page 7: Lecture 37: Lies My Professor Told Me

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?

Page 8: Lecture 37: Lies My Professor Told Me

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?