Optimized memcpy to reduce cache misses

Discussion in 'C++' started by John Edwards, Aug 3, 2003.

  1. John Edwards

    John Edwards Guest

    I'm trying to come up with a more cache efficient memcpy loop
    to reduce the number of cache misses I'm experiencing.

    My current solution:

    for (i = 1; i < numlines; i++)
    {
    foo(Offset >= 0);
    RMemCopy(CurrentPos, Line, (unsigned)Abs(Offset));
    CurrentPos += Offset;
    }



    I'm even open to inline ASM.

    Any ideas?
     
    John Edwards, Aug 3, 2003
    #1
    1. Advertising

  2. On Sun, 03 Aug 2003 12:12:05 GMT, "John Edwards" <>
    wrote:

    >I'm trying to come up with a more cache efficient memcpy loop
    >to reduce the number of cache misses I'm experiencing.
    >
    >My current solution:
    >
    > for (i = 1; i < numlines; i++)
    > {
    > foo(Offset >= 0);
    > RMemCopy(CurrentPos, Line, (unsigned)Abs(Offset));
    > CurrentPos += Offset;
    > }
    >
    >
    >
    >I'm even open to inline ASM.
    >
    >Any ideas?
    >


    This is not a C++-related question, but a microprocessor-specific one.

    Having said that, I have written memcpy and memset routines that are
    specifically targeted to take advantage of a particular microprocessor's
    instruction and data cache architecture.

    How I did it is beyond the scope of this newsgroup.
     
    Dave Rahardja, Aug 7, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave
    Replies:
    1
    Views:
    1,951
    jfbriere
    Nov 18, 2005
  2. Eugenio Callejas

    Cache and AOL Optimized

    Eugenio Callejas, Sep 27, 2004, in forum: HTML
    Replies:
    2
    Views:
    396
    Adam Bailey
    Sep 28, 2004
  3. David Bradley
    Replies:
    0
    Views:
    560
    David Bradley
    Aug 7, 2003
  4. Charles Erwin
    Replies:
    4
    Views:
    594
    Joe Wright
    Oct 6, 2003
  5. Matthew Wilson
    Replies:
    2
    Views:
    413
    Peter Otten
    Nov 22, 2003
Loading...

Share This Page