Describes the occasions you should choose a flat buffer and when to choose a segmented buffers.
The choice between using an array implemented with a flat buffer against using an array implemented with a segmented buffer depends on the characteristics of the application.
Choose a flat buffer:
if efficiency in transforming between buffer position and memory address is very important.
if the re-allocations needed to extend the buffer are sufficiently rare that they do not cause intolerable amounts of data copying or heap fragmentation.
if there is an upper bound on the size limit and can reserve sufficient room before inserting elements.
Choose a segmented buffer:
to minimise the heap thrashing and copying that can be associated with reallocating a single flat buffer.
if the performance of frequent insertions and deletions is a concern. This can be better with segmented buffers, because not all data after the insertion/deletion point needs to be shuffled to complete the operation.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License v1.0.