[PolyORB-users] Memory management optimization in sequences

Maciej Sobczak prog at msobczak.com
Mon May 19 14:27:09 CEST 2008


Thomas Quinot wrote:

> Sure, feel free to submit a patch.

I hoped to trigger some discussion first.  ;-)

Seriously, in one of the projects I'm working on we've had a severe 
performance problem due to exactly this issue. The user code created a 
lengthy sequence by appending elements one by one and with the memory 
allocator that was already slow on the given system the total quadratic 
complexity of this process translated into long delay. Too long for what 
we did.
The solution on the user side was to emulate the above improvement 
explicitly and then trim the remaining (unused) part before 
transmission. We could afford the increased memory consumption to handle 
it. It worked fine, but I'd prefer not to have the problem in the first 
place.
It was not related to PolyORB (and not even to Ada), but the mechanics 
of this problem is universal.

There are two points to keep in mind:
1. The improvement changes O(n) into amortized O(1) for appends.
2. It increases the average memory consumption for sequences by the 
20%-50% factor, depending on details.

One of the points above is good.

I can provide the patch, but not blindly - your comments are welcome.

Regards,

-- 
Maciej Sobczak * www.msobczak.com * www.inspirel.com


More information about the PolyORB-users mailing list