Conversion to string + string building benchmark

Robert Jacques sandford at jhu.edu
Sun Apr 3 20:10:51 PDT 2011


On Sat, 19 Mar 2011 22:14:50 -0400, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Robert Jacques:
>
> Happy to see my post was not fully lost in the noise :-)
>
>> And I would
>> hazard that Java's StringBuilder isn't giving you O(1) access to the
>> underlying array like Appender is, which would allow it to drastically
>> reduce memory churn.
>
> The first purpose of an Appender/builder is to build an array as fast as  
> possible. I don't need a very access to the array while I build it (a  
> Deque too allows O(1) too, just a bit slower).
>
>
>> In the future, you should also include program ram usages in these kind  
>> of
>> benchmarks.
>
> The amount of memory used/commited is less easy to measure precisely,  
> here are approximated values, the result are weird:
>
> Timings, best of 3, n = 10_000_000, MB (commit):
>   D test1:  290
>   D test2a: 186
>   D test2b:   1.9
>   D test3:  188
>   D test4:  106
>   Java -Xmx500M -server Test1:  355
>   Java -Xmx500M -server Test2a: 355
>   Java -Xmx500M -server Test2b: 355
>
> Bye,
> bearophile

I've filled this issue in bugzilla as issue 5813  
(http://d.puremagic.com/issues/show_bug.cgi?id=5813) along with a patch  
I've developed.


More information about the Digitalmars-d mailing list