performance of structs vs classes

Christian Köstlin christian.koestlin at gmail.com
Mon Sep 26 13:51:08 PDT 2011


On 09/26/2011 10:34 PM, Steven Schveighoffer wrote:
> On Mon, 26 Sep 2011 15:36:04 -0400, Christian Köstlin
> <christian.koestlin at gmail.com> wrote:
>
>> On 09/26/2011 08:29 PM, Andrej Mitrovic wrote:
>>> In the class test reset the timer:
>>> {
>>> auto h = new HClass();
>>> sw.reset(); //<-
>>> sw.start();
>>> }
>> thanks a lot ... i totally misused the stopwatch api.
>>
>> i compiled with:
>> dmd -release -O -inline -m64 -oftarget/dmd/structs_vs_classes
>> experimental/structs_vs_classes.d
>> and
>> gdc -O3 -inline -o target/gdc/structs_vs_classes
>> experimental/structs_vs_classes.d
>>
>> wich resulted in:
>> target/dmd/structs_vs_classes
>> time with struct: 11326 for 1
>> time with class: 11323 for 1
>>
>> and
>> target/gdc/structs_vs_classes
>> time with struct: 4011 for 1
>> time with class: 6880 for 1
>
> use -frelease to disable invariant calls on gdc.
>
> Very important!
>
> -Steve
you are right ... this leads to 6183 for gdc with class

thanks!

christian



More information about the Digitalmars-d-learn mailing list