[llvm-commits] Fwd: Patch for review: Speeding up ScheduleDAG computations

Chris Lattner clattner at apple.com
Tue Mar 4 11:34:43 PST 2008


>>> I'd like to understand better why Evan and Chris are some much  
>>> against
>>> std::set? From some mails I got the impression that std::set
>>> implementation is very inefficient on Darwin or PowerPC? Is it
>>> correct? Or do you dislike that fact that std::set uses dynamic  
>>> memory
>>> allocation extensively?
>>
>>
>> Right, it's very malloc intensive. That's the main issue.

There is a reasonable discussion of these issues here:
http://llvm.org/docs/ProgrammersManual.html#datastructure

> I think we may have a reasonable solution here. Remember that STL
> allows us to provide our own allocators as a template parameter for
> all collection classes including std::set. So, in principle we can use
> a cutom pool allocator or something like that to make std::set less
> memory intensive.

This isn't really a good solution.  Node based data structures are  
inherently less cache and memory efficient than dense ones (e.g. map  
vs densemap) regardless of the allocator you use.  Making malloc  
faster improves the situation, but it doesn't solve the underlying  
problem.  If you have per-datastructure heaps, you suffer significant  
fragmentation problems.

-Chris



More information about the llvm-commits mailing list