Unrelated Qs: profilers & memcpy()

Started by
12 comments, last by d000hg 20 years, 8 months ago
quote:Original post by xf00f
quote:
How does memcpy work?

I believe it depends upon your OS, but under MS Windows the call is passed off to a kernel level routine (hmemcpy maybe, but don''t quote me on that )which copies the maximum no. of DWORDS it can and then finishes off by copying the last few outstanding BYTES if there are any.


Look at memcpy.asm (if you installed the CRT source). Actually, i don''t understand what its doing, but it seems to copy 4 bytes (1 DWORD) at a time. Its certainly not a kernel routine.
Advertisement
quote:Original post by Burning_Ice
nope, works fine for other code too..even says so on their features page:
"profiles managed VB .NET, VC++, C#, JScript 7 and unmanaged


But he is using VC 6
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
quote:Original post by JohnBolton
But he is using VC 6

yep, sorry, only really read his second post, didn''t see he was using VS6.


P("post" | "don''t know what you are talking about") = 0, right?

> It being the most efficient way of doing it I would have a hard time believing other implementations do it any differently. <
rep movsd is certainly not the most efficient way of copying memory on anything > 486.

quote:
> byte copy vs. dword actually hardly makes a difference anymore
I would have to disagree on that - unless you are just copying very small arrays, then movsd will be four times faster than movsb (all movsX instructions take the same no. of clock cycles regardless of size)

"Disagree"? This isn''t opinion - try it out I''d call the difference 3% on my Athlon XP.
Also, rep movs is not a series of copy instructions - if aligned and size > 64, the CPU does a burst transfer.
The point is moot, since there are faster ways to copy memory: block prefetch for transfers > working set, and an unrolled copy loop for smaller sizes.

> I agree that for small random copies of memory cache misses will take a large toll when compared to the time the instructions take to complete, but that''s something to manage in your code. <
Indeed. The copy code must take this into account.


> Why''s it keep throwing me out and how do I actually get some relevant info?
Check project options - stop on app exit, don''t terminate app.
E8 17 00 42 CE DC D2 DC E4 EA C4 40 CA DA C2 D8 CC 40 CA D0 E8 40E0 CA CA 96 5B B0 16 50 D7 D4 02 B2 02 86 E2 CD 21 58 48 79 F2 C3

This topic is closed to new replies.

Advertisement