On Apr 22, 2010, at 11:18 PM, trumpetinc wrote: > > I like your approach! A simple if (ch > 32) return false; at the very top > would give the most bang for the least effort (if you do go the bitmask > route, be sure to include unit tests!).
Doing this change spares approximately two seconds out of the full workload so now shows 8s instead of 10s and isWhitespace stays at 1%. The numbers below include two extra changes: the one from trumpetinc above and migrating all StringBuffer references to use instead StringBuilder. The top are now: PRTokeniser.nextToken 8% 77s 19'268'000 invocations RandomAccessFileOrArray.read 6% 53s 149'047'680 invocations MappedRandomAccessFile.read 3% 26s 61'065'680 invocations PdfReader.removeUnusedCode 1% 15s 6000 invocations PdfEncodings.convertToBytes 1% 15s 5'296'207 invocations PRTokeniser.nextValidToken 1% 12s 9'862'000 invocations PdfReader.readPRObject 1% 10s 5'974'000 invocations ByteBuffer.append(char) 1% 10s 19'379'382 invocations PRTokeniser.backOnePosition 1% 10s 17'574'000 invocations PRTokeniser.isWhitespace 1% 8s 35'622'000 invocations A bit further down there is ByteBuffer.append_i that often needs to reallocate and do an array copy thus the expensive ByBuffer.append(char) above ... I am playing right now with bigger initial sizes e.g. 512 instead of 127 ... Best regards, Giovanni ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/