d2 file input performance

Christian Köstlin christian.koestlin at gmail.com
Sun Sep 4 10:01:36 PDT 2011


On 9/3/11 7:53 , dennis luehring wrote:
> Am 26.08.2011 19:43, schrieb Christian Köstlin:
>> Hi guys,
>>
>>
>> i started the thread:
>> http://stackoverflow.com/questions/7202710/fastest-way-of-reading-bytes-in-d2
>>
>> on stackoverflow, because i ran into kind of a problem.
>>
>> i wanted to read data from a file (or even better from a stream, but
>> lets stay with file), byte-by-byte. the whole thing was part of my
>> protobuf implementation for d2, and there you have to look at each byte
>> to read out the varints. i was very proud of my implementation until i
>> benchmarked it first against java (ok ... i was a little slower than
>> java) and then against c++ (ok ... this was a complete different game).
>>
>> after some optimizing i got better, but was still way slower than c++.
>> so i started some small microbenchmarks regarding fileio:
>> https://github.com/gizmomogwai/performance in c++, java and d2.
>>
>> could you help me improve on the d2 performance? i am sure, that i am
>> missing something fundamental, because i thing it should be at least
>> possible be equal or better than java.
>>
>> thanks in advance
>>
>> christian
>
> i would change the test szenario a little bit
>
> 1. use a ramdisk - so stuff like location on disk, fragmentation, driver
> speed will reducued down to a little bit of noise
>
> 2. make your szenario much bigger
>
> 3. would be interesting to see for example to cumulated every 1000
> benchmarks-steps or something like that - to see caching coming in etc.
>
> running 10.000 times
>
> time for 1. 1000 steps xyzw
> time for 2. 1000 steps xyzw
> time for 3. 1000 steps xyzw
> time for 4. 1000 steps xyzw
> overall time ... xyz
> ...
good point ...
will see if i can adapt the tests...

cK



More information about the Digitalmars-d-learn mailing list