struct vs class benchmark (was Re: Give struct the status it deserves)

Hong Hong_member at pathlink.com
Sun Mar 26 16:32:40 PST 2006


Ok, even people are telling me that class is not slower, I have decided to make
a benchmark to test them out. Here they are,

Version using struct
http://members.iinet.net.au/~honglee/benchmark/benchmarkstruct.d

Version using class
http://members.iinet.net.au/~honglee/benchmark/benchmarkclass.d

On my computer, the struct version runs 300 times faster than the class version.
Interestingly, deleting the object explicitly in the class version actually
slowed the program even further.

The difference seems real.

In article <e07506$1ss2$1 at digitaldaemon.com>, Hasan Aljudy says...
>
>What's wrong with classes?!
>
>Classes won't make your code slow.
>





More information about the Digitalmars-d mailing list