Reddit: why aren't people using D?

Steven Schveighoffer schveiguy at yahoo.com
Thu Jul 23 12:13:04 PDT 2009


On Thu, 23 Jul 2009 14:06:12 -0400, Jarrett Billingsley  
<jarrett.billingsley at gmail.com> wrote:

> On Thu, Jul 23, 2009 at 1:20 PM, Steven
> Schveighoffer<schveiguy at yahoo.com> wrote:
>
>>
>> However, when I realized that with a custom allocator, I could  
>> tremendously
>> increase performance, I had to switch to structs.
>
> Um, did you?  Because you can have custom allocators for classes too..

First, there were other reasons, such as I don't need polymorphism or  
interfaces for those node types, so switching to structs helped eliminate  
bloat for those features.

What I did was allocate an array of structs vs. allocating each node,  
which uses the GC less.  The less you use the GC the better when it comes  
to performance :)

Can you do that with classes, I don't know.  I thought it was impossible  
to allocate several classes in one block.  It was pretty easy to do the  
custom allocator with structs...

-Steve



More information about the Digitalmars-d mailing list