Replacing C's memcpy with a D implementation

Mike Franklin slavo5150 at yahoo.com
Mon Jun 11 10:38:30 UTC 2018


On Monday, 11 June 2018 at 10:07:39 UTC, Walter Bright wrote:

>> I think there might also be optimization opportunities using 
>> templates, metaprogramming, and type introspection, that are 
>> not currently possible with the current design.
>
> Just making it a template doesn't automatically enable any of 
> this.

I think it does, because I can then generate specific code based 
on the type information at compile-time.

>> So there are other reasons to pursue a template design for all 
>> of our runtime hooks, and if our memcpy, memcmp, etc.. are 
>> also templated it't turtles all the way down.
>
> memcpy and memcmp are already handled specially by modern 
> compilers, have been for decades; I seriously doubt there's 
> more oil in that well.

Yes, I may fail to achieve any performance benefits, but even if 
I achieve parity with the current implementation it will still be 
a win for me because I will no longer have to depend on the C 
standard library.  And if I have to fork to use D that way, then 
that's what I'm going to do.

Mike




More information about the Digitalmars-d mailing list