Best interface for memcpy() (and the string.h family of functions)

Stefanos Baziotis sdi1600105 at di.uoa.gr
Wed May 29 20:28:18 UTC 2019


On Wednesday, 29 May 2019 at 19:35:36 UTC, Jonathan Marler wrote:
>
> Yes that would be an answer, I guess I got confused when you 
> mentioned CTFE and introspection, I wasn't sure if "benchmarks" 
> was referring to those features or to runtime benchmarks.  And 
> looks like @Mike posted the benchmarks on that github link you 
> sent.
>
Great, you can see that in the benchmarks, memcpyD is faster than 
libc memcpy
except for sizes larger than 32768. We hope that we can surpass 
those
as well, as yesterday I did some simple inline SIMD things and 
got better performance in 32768.
But previous work is of course responsibility of Mike and those 
benchmarks
are in part because of inlining.

>
> It's true that if you can assume pointers are aligned on a 
> particular boundary that you can be faster than memcpy which 
> works with any alignment.  This must be what Mike is doing, 
> though, I would then create only a few instances of memcpy that 
> assume alignment on boundaries like 4, 8, 16.  And if you have 
> a pointer or an array to a particular type, you can probably 
> assume that pointer/array is aligned on that types's "alignof" 
> property.
>

This is, as I said, the alignment guarrantee. I hope that I can 
get other benefits
from types also.
Also, hopefully we will do LDC / GDC specific things. Leverage 
the intrinsics for example.
I will put an update shortly, as the other students, explaining 
some of that, but I thought since we started it.. :p

> I think I will use this in my library.

Great! We hope that it will be useful and any feedback is 
appreciated!




More information about the Digitalmars-d mailing list