Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 4.0 - Beta
-
Fix Version/s: 4.0
-
Component/s: Core/Parsing
-
Labels:None
-
Environment:Win XP SP3, Sun jdk1.5.0_19 and jdk1.6.0_14, Intel Core 2 Duo 2.13 GHz, 2 GB RAM.
Description
After doing PDF-127 memory optimisations, now would be a good time to do some CPU optimisations. I noticed that on the Android website they gave a list of optimisation recommendations, so figured I'd try out the one where you access class instance fields via a cached stack reference. Patrick pointed out that in PDFs with a large number of shapes, we spend a disproportionate amount of time growing the shapes vector.
All testing was done on \\iceads1\Public\ICEpdf Development\QA\transitmap_2004.pdf which contains over 566,000 shapes. We parse it into a single shapes vector. I ran all the tests under a modified version of the tagging code from PDF-114, where it would only load that one PDF and go through the pages, of which there is only one, and init() the page. The file is loaded locally, from my hard-drive, and the milliseconds are reported from load to dispose.
Commencing tagging file 1439 of 1532
D:\ICEpdf\iceads1__Public__ICEpdf_Development\QA\transitmap_2004.pdf
I ran the test 4x in a row, and discarded the first run, since that would reflect system caching more than anything. This is the baseline:
Duration: 54.531 seconds
Duration: 54.640 seconds
Duration: 54.890 seconds
All testing was done on \\iceads1\Public\ICEpdf Development\QA\transitmap_2004.pdf which contains over 566,000 shapes. We parse it into a single shapes vector. I ran all the tests under a modified version of the tagging code from PDF-114, where it would only load that one PDF and go through the pages, of which there is only one, and init() the page. The file is loaded locally, from my hard-drive, and the milliseconds are reported from load to dispose.
Commencing tagging file 1439 of 1532
D:\ICEpdf\iceads1__Public__ICEpdf_Development\QA\transitmap_2004.pdf
I ran the test 4x in a row, and discarded the first run, since that would reflect system caching more than anything. This is the baseline:
Duration: 54.531 seconds
Duration: 54.640 seconds
Duration: 54.890 seconds
For the first optimisation attempt, I wanted to alter Parser and ContentParser, to use stack references instead of class field references.
After altering Parser, we can see absolutely zero difference:
Duration: 54.671 seconds
Duration: 54.499 seconds
Duration: 54.765 seconds
Duration: 54.577 seconds
After altering Parser, we can see absolutely zero difference:
Duration: 54.734 seconds
Duration: 54.718 seconds
So, that Android optimisation just doesn't apply to a Sun Java 1.6 Intel Core 2 Duo system. I didn't bother with any other Android suggestions, after that.