Linking with a non-default druntime

Per Nordlöw per.nordlow at gmail.com
Tue Oct 9 11:18:58 UTC 2018


On Tuesday, 2 October 2018 at 13:07:04 UTC, Basile B. wrote:
> On Monday, 1 October 2018 at 11:10:07 UTC, Per Nordlöw wrote:
>> On Monday, 1 October 2018 at 08:27:54 UTC, Basile B. wrote:
>>> I think so. Apparently it's registered with a string, e.g 
>>> "manual" and you pass a special druntime option with your 
>>> program to select.
>>> Actually i would be interested to make the interface with 
>>> assignable handlers since you don't seem to be very hot. 
>>> Maybe tomorrow i can try. I'm almost sure that this could 
>>> work but cant be 100% sure. Maybe there'll be issues with 
>>> privacy and events to assign.
>>
>> Be my guest :)
>>
>> Thanks!
>
> I see other related topics, did you already start something ?

Yes!

I'm making interesting progress here:
https://github.com/nordlow/druntime/blob/fastalloc-gc/src/gc/impl/fastalloc/gc.d

I'm currently writing the spec in a comment and experimenting 
with faster (both global and thread-local) allocations

using

https://github.com/nordlow/phobos-next/blob/master/snippets/gctester.d

as a benchmark, compiled with

https://github.com/nordlow/scripts/blob/master/dmd-own

which gives

[per:~/Work/knet/phobos-next/snippets] 12s $ dmd-own gctester.d 
--DRT-gcopt=gc:fastalloc
  size new-C new-S GC.malloc gc_tlmalloc_N GC.calloc malloc calloc 
FreeList!(GCAllocator)
     8  46.8  58.3    26.0        7.5        23.8     31.2   31.3  
  29.1
    16  33.6  23.1    12.7        4.7        13.0     16.5   14.9  
  16.0
    32  15.5  13.5     6.7        2.9         7.0      8.2   10.2  
   9.6
    64  11.5   9.7     4.1        1.8         3.9      6.4    5.2  
   4.8
   128   9.3   6.9     2.6        1.6         2.5      4.2    3.8  
   3.0
   256   8.8   5.4     1.9        1.4         1.9      3.2    2.9  
   2.2
   512   7.6   4.3     1.6        1.3         1.5      2.6    2.8  
   1.7
  1024   7.3   4.1     1.5        1.3         1.4      2.2    2.5  
   1.5
   ns/w: nanoseconds per word

vs

[per:~/Work/knet/phobos-next/snippets] 4s $ dmd-own gctester.d 
--DRT-gcopt=gc:conservative
  size new-C new-S GC.malloc gc_tlmalloc_N GC.calloc malloc calloc 
FreeList!(GCAllocator)
     8  75.4  54.7    39.1        8.9        42.1     28.8   32.1  
  39.6
    16  32.0  27.5    18.6        4.6        20.9     15.2   17.0  
  20.1
    32  15.7  16.0    10.5        2.9        12.3      9.0   10.7  
  11.0
    64  10.2   9.0     7.7        1.9         6.2      5.3    6.3  
   6.6
   128   7.9   6.0     5.0        1.5         4.2      4.5    3.8  
   4.8
   256   6.1   4.7     2.9        1.3         3.4      3.2    2.9  
   3.6
   512   5.6   3.5     3.0        1.3         3.0      2.6    2.8  
   2.8
  1024   5.0   2.9     2.5        1.2         2.6      2.3    2.5  
   2.5
   ns/w: nanoseconds per word

Note that gc_tlmalloc_N uses the new allocator in both cases. I 
haven't bothered branching the benchmark on type of GC config.

I'm planning on making it sweep-free as described in

https://github.com/golang/proposal/blob/master/design/12800-sweep-free-alloc.md


More information about the Digitalmars-d-learn mailing list