[GSoC 2019] Interested in Baremetal D Runtime and project ideas

Mike Franklin slavo5150 at yahoo.com
Mon Apr 8 10:47:17 UTC 2019


On Monday, 8 April 2019 at 02:13:30 UTC, Mike Franklin wrote:

>
> If it's difficult to see why converting them to D would be 
> advantageous, well, that's probably my fault.  I don't know how 
> else to say it.  As I mentioned previously, once the runtime 
> hooks are converted to templates, it should become much more 
> apparent to all without me having to advocate for it.
>

Here's a little data I gathered very quickly to illustrate why 
there might be performance benefits.  Below is a table of all the 
calls to `memcpy` that DMD makes when compiling Phobos and 
druntime.

What's disappointing to me is the extremely larger number of 
calls to `memcpy` to copy 8-bytes of data on a 64-bit machine 
(not to mention the few to for 0 bytes!).

Now imagine if that were a template like this 
(https://github.com/JinShil/memcpyD/blob/56dfe65cbae4407fa584e53dac54c105d433e958/memcpyd.d#L17-L22) that could be inlined.  I think there would be some performance benefits.

It's actually quite alarming how many calls there are to memcpy 
for such small amounts of data.

Phobos:
   count fn     size_in_bytes
   48420 memcpy 8
   26298 memcpy 2
   26298 memcpy 1
    6484 memcpy 33
    4766 memcpy 136
    4250 memcpy 25
    2308 memcpy 32
    1994 memcpy 35
    1444 memcpy 31
    1272 memcpy 34
    1000 memcpy 37
     928 memcpy 28
     816 memcpy 41
     614 memcpy 42
     560 memcpy 44
     458 memcpy 43
     388 memcpy 40
     388 memcpy 30
     372 memcpy 36
     324 memcpy 39
     304 memcpy 45
     272 memcpy 29
     268 memcpy 38
     254 memcpy 20
     248 memcpy 46
     192 memcpy 49
     192 memcpy 47
     176 memcpy 48
     104 memcpy 27
      84 memcpy 51
      72 memcpy 50
      72 memcpy 26
      64 memcpy 63
      64 memcpy 52
      48 memcpy 0
      28 memcpy 53
      26 memcpy 16
      22 memcpy 24
      20 memcpy 58
      20 memcpy 57
      20 memcpy 54
      16 memcpy 73
      16 memcpy 55
      12 memcpy 82
      12 memcpy 70
      12 memcpy 56
      12 memcpy 22
       8 memcpy 92
       8 memcpy 83
       8 memcpy 81
       8 memcpy 76
       8 memcpy 72
       8 memcpy 68
       8 memcpy 65
       8 memcpy 64
       8 memcpy 61
       8 memcpy 60
       8 memcpy 19
       4 memcpy 98
       4 memcpy 90
       4 memcpy 89
       4 memcpy 85
       4 memcpy 79
       4 memcpy 78
       4 memcpy 74
       4 memcpy 71
       4 memcpy 69
       4 memcpy 67
       4 memcpy 66
       4 memcpy 168
       4 memcpy 104
       2 memcpy 8192
       2 memcpy 57344
       2 memcpy 109

druntime:
    3285 memcpy 8
     447 memcpy 136
     130 memcpy 16
      10 memcpy 8192
      10 memcpy 32
       2 memcpy 24
       2 memcpy 0




More information about the Digitalmars-d mailing list