Re: CPU's cache in mind
- From: "randyhyde@xxxxxxxxxxxxx" <randyhyde@xxxxxxxxxxxxx>
- Date: 4 Jan 2006 14:58:37 -0800
Mike King wrote:
> I have a very simple program that I want to optimize for speed. What are
> the do's and dont's for writing with the CPU's cache in mind? This program
> uses less than <1K for RAM but it can easily take hours to run to find the
> solution. I would like for this to run totally out of the cache to optimize
> for speed.
If it uses less than 1K RAM, it probably fits in the cache of almost
any modern processor. If your CPU has less cache than this, then the
usual rules of spatial and temporal locality apply. You might consider
checking out my book "Write Great Code, Volume 1:Understanding the
machine" if you're interested in improving performance by considering
machine organization
http://www.amazon.com/gp/product/1593270038/qid=1136415362/sr=8-1/ref=pd_bbs_1/104-8824313-9915924?n=507846&s=books&v=glance
Volume 2 (Thinking Low-Level, Writing High-Level) should be out in the
next month or two, and discusses how to choose your HLL statements to
improve application performance.
Realistically, though, it sounds like you need a better algorithm more
than anything else. Granted, even a constant performance improvement
would help, but it doesn't sound like improving cache hits is going to
do much good for your application.
Cheers,
Randy Hyde
.
- Follow-Ups:
- Re: CPU's cache in mind
- From: \\\\\\o///annabee
- Re: CPU's cache in mind
- From: Mike King
- Re: CPU's cache in mind
- References:
- CPU's cache in mind
- From: Mike King
- CPU's cache in mind
- Prev by Date: Re: [repost]Eorros for me, in the assembly history
- Next by Date: Re: Trivia Question
- Previous by thread: Re: CPU's cache in mind
- Next by thread: Re: CPU's cache in mind
- Index(es):
Relevant Pages
|