473,385 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Optimized memcpy to reduce cache misses

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?
Jul 19 '05 #1
1 4333
On Sun, 03 Aug 2003 12:12:05 GMT, "John Edwards" <sa***@caselearning.com>
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.

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

133
by: Gaurav | last post by:
http://www.sys-con.com/story/print.cfm?storyid=45250 Any comments? Thanks Gaurav
35
by: Christopher Benson-Manica | last post by:
(if this is a FAQ or in K&R2, I didn't find it) What parameters (if any) may be 0 or NULL? IOW, which of the following statements are guaranteed to produce well-defined behavior? char src;...
7
by: Richard Hayden | last post by:
Hi, I've just upgraded my gcc and I'm currently trying to compile some code for my own operating system kernel, but I am getting an error of "Undefined reference to `memcpy`" when I try to link...
36
by: Olga Sayenko | last post by:
Hi, I am trying to make sure that my data doesn't show up anywhere outside my process unencrypted. I am concerned that if I use memcpy, the bytes copied will end up in some memory somewhere...
33
by: Case | last post by:
#define SIZE 100 #define USE_MEMCPY int main(void) { char a; char b; int n; /* code 'filling' a */
1
by: Jim | last post by:
Hi, I have a few questions regarding the cache object: Does the cache object exist through postbacks? The cache object only exists for the current request, right? Is there a way to cache...
2
by: NWx | last post by:
Hi, Is Cache appropriate to store persistent variables used across the application? What I want is to store UserID for currently logged user, SessionID (my own SessionID, which keep track of...
3
by: Nope | last post by:
LO everybody, I have a string (defined as a character array), and a structure which comprises of unsigned chars, chars or char arrays. I want to copy the 'string' into the structure, in one...
5
by: J055 | last post by:
Hi The following code works on my develeopment machine using the VS web server. When I run the application on 2 other Windows 2003/IIS 6 servers no caching seems to take place at all. Can...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.