very small additional speed improvement (less garbage)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1148006 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-18 19:02:16 +00:00
parent f666208048
commit 061e873f3c
1 changed files with 21 additions and 15 deletions

View File

@ -64,6 +64,7 @@ public class PAPBinTable
* {@link #PAPBinTable(byte[],byte[],byte[],int,int,int,TextPieceTable,boolean)}
* instead
*/
@SuppressWarnings( "unused" )
public PAPBinTable( byte[] documentStream, byte[] tableStream,
byte[] dataStream, int offset, int size, int fcMin,
TextPieceTable tpt )
@ -216,6 +217,15 @@ public class PAPBinTable
papxToFileOrder.put( papx, Integer.valueOf( counter++ ) );
}
}
final Comparator<PAPX> papxFileOrderComparator = new Comparator<PAPX>()
{
public int compare( PAPX o1, PAPX o2 )
{
Integer i1 = papxToFileOrder.get( o1 );
Integer i2 = papxToFileOrder.get( o2 );
return i1.compareTo( i2 );
}
};
logger.log( POILogger.DEBUG, "PAPX's order map created in ",
Long.valueOf( System.currentTimeMillis() - start ), " ms" );
@ -277,15 +287,7 @@ public class PAPBinTable
}
// restore file order of PAPX
Collections.sort( papxs, new Comparator<PAPX>()
{
public int compare( PAPX o1, PAPX o2 )
{
Integer i1 = papxToFileOrder.get( o1 );
Integer i2 = papxToFileOrder.get( o2 );
return i1.compareTo( i2 );
}
} );
Collections.sort( papxs, papxFileOrderComparator );
SprmBuffer sprmBuffer = null;
for ( PAPX papx : papxs )
@ -312,6 +314,10 @@ public class PAPBinTable
}
this._paragraphs = new ArrayList<PAPX>( newPapxs );
logger.log( POILogger.DEBUG, "PAPX rebuilded from document text in ",
Long.valueOf( System.currentTimeMillis() - start ), " ms" );
start = System.currentTimeMillis();
_dataStream = dataStream;
}