Symbian3/SDK/Source/GUID-763A2636-D448-5353-9E31-F61FE7EB39DA.dita
changeset 7 51a74ef9ed63
parent 0 89d6a7a84779
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-763A2636-D448-5353-9E31-F61FE7EB39DA" xml:lang="en"><title>Flat
       
    13 or segmented buffer?</title><shortdesc>Describes the occasions you should choose a flat buffer and when
       
    14 to choose a segmented buffers.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <p>The choice between using an array implemented with a flat buffer against
       
    16 using an array implemented with a segmented buffer depends on the characteristics
       
    17 of the application.</p>
       
    18 <p>Choose a flat buffer:</p>
       
    19 <ul>
       
    20 <li id="GUID-0FC7D827-EA67-598C-8DE6-91860661DA7C"><p>if efficiency in transforming
       
    21 between buffer position and memory address is very important.</p> </li>
       
    22 <li id="GUID-73802049-15D7-550A-8093-87BF3CA2E387"><p>if the re-allocations
       
    23 needed to extend the buffer are sufficiently rare that they do not cause intolerable
       
    24 amounts of data copying or heap fragmentation.</p> </li>
       
    25 <li id="GUID-2129EE71-7859-5B77-91FD-F036348C92D6"><p>if there is an upper
       
    26 bound on the size limit and can reserve sufficient room before inserting elements.</p> </li>
       
    27 </ul>
       
    28 <p>Choose a segmented buffer:</p>
       
    29 <ul>
       
    30 <li id="GUID-912802E0-C66D-56F1-9977-6B04BFD833AC"><p>to minimise the heap
       
    31 thrashing and copying that can be associated with reallocating
       
    32 a single flat buffer.</p> </li>
       
    33 <li id="GUID-CE5DB4C3-BC72-5D09-B55A-552D08CB8EF6"><p>if the performance of
       
    34 frequent insertions and deletions is a concern. This can be better with segmented
       
    35 buffers, because not all data after the insertion/deletion point needs to
       
    36 be shuffled to complete the operation.</p> </li>
       
    37 </ul>
       
    38 </conbody></concept>