Phobos begat madness

David Bennett davidbennett at bravevision.com
Mon Jun 25 01:03:03 UTC 2018


On Friday, 22 June 2018 at 21:37:07 UTC, Walter Bright wrote:
>
> If someone wants to figure out how to build an uncomplicated, 
> straightforward, efficient implementation of text() that we can 
> be proud of, that would be a nice contribution.

Here [0] is part of a benchmark for implementing `to!string` with 
the lower level api design I was talking about in my other post 
[1].

On my machine i get these results:

$ dmd -dip1000
to!(string):        17 secs, 88 ms, 322 μs, and 1 hnsec
newTo!(string):     8 secs, 785 ms, 325 μs, and 1 hnsec
@nogc writeCharsTo: 4 secs, 404 ms, 21 μs, and 7 hnsecs

$ dmd -dip1000 -O -release -inline
to!(string):        9 secs, 396 ms, 688 μs, and 1 hnsec
newTo!(string):     4 secs, 640 ms, and 698 μs
@nogc writeCharsTo: 1 sec, 288 ms, 176 μs, and 9 hnsecs

$ ldc2 -dip1000 -O3 -release
to!(string):        4 secs, 489 ms, 52 μs, and 3 hnsecs
newTo!(string):     3 secs, 781 ms, 990 μs, and 5 hnsecs
@nogc writeCharsTo: 752 ms, 989 μs, and 5 hnsecs

I will upload the benchmark for `text` tonight.

Also other points to make are:
    Using this low level api will work in -betterC code.
    It might even fit into utiliD [2].

[0] 
https://run.dlang.io/gist/97639a90931ad8e6e3a1ea564c46d710?args=-O%20-release%20-inline%20-dip1000
[1] 
https://forum.dlang.org/post/erxtrmnqbcbtgokoutbc@forum.dlang.org
[2] https://github.com/JinShil/utiliD



More information about the Digitalmars-d mailing list