Re: CPU's cache in mind




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

.



Relevant Pages

  • Re: CPUs cache in mind
    ... >> the do's and dont's for writing with the CPU's cache in mind? ... >> uses less than <1K for RAM but it can easily take hours to run to find ... but it doesn't sound like improving cache hits is going to ...
    (alt.lang.asm)
  • Re: CPUs cache in mind
    ... uses less than <1K for RAM but it can easily take hours to run to find the ... I would like for this to run totally out of the cache to optimize ... 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 ...
    (alt.lang.asm)
  • RE: Disk vs Tape scenario
    ... With the storage available for me to test it is hard to eliminate cache ... Theoretically a volume using RAID-10 on 8x10K RPM disks can handle ... A write SSCH rate of 475/sec would push the RAID-10 parity group to 950 ... I just tested with two IEBDG jobs writing 20 million 80 byte records ...
    (bit.listserv.ibm-main)
  • Re: Cache questions
    ... > sets and the MMX and XMM registers where possible. ... > I'm writing a routine which will need to read from a source bitmap ... especially when it causes cache misses. ... > some stack space, and I could write one of my local variables with, ...
    (comp.lang.asm.x86)
  • Re: need fastest way to write 2gig array to disk file
    ... Eric Taylor wrote: ... > writes seem to go directly to the cache and so a 2 gig output ... > On another similar system, with scsi disks, once the program ... (when writing to the cache, ...
    (comp.os.linux.development.apps)