Re: Speeding up pdf:api2
"spinningwebz2002" <spinningwebz2002-/[email protected]> Thu, 04 Sep 2008 11:54:06 -0000
| Newsgroups | gmane.comp.lang.perl.modules.pdfapi2 |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], "spinningwebz2002" <spinningwebz2002@...> wrote: > > I looking for ways of speeding up how long it takes PDF::API2 to get > started (once it gets going it is very spiffy). One of the things I > noticed while profiling it that it loads the uniglyph.txt file. Can > this be trimmed down if you know you are not using all the unicode > characters? Would this increase the startup time? If not, are there > other ways of speeding it up? > > I have some basic caveats that I will be using with the PDF:API2, maybe > there are things that could be done to make it quicker: > > 1. I will not be using any internal fonts. > 2. I will always be using specific fonts that I load with ttfont. > 3. I will always be using the english character set. > 4. All images inserted into the pdf will always be jpg. > > Bill H > As a follow, I decided to trim off all the glpyhs in uniglyph.txt above $FF and using the perl profiler to examine it: Original uniglyph.txt: Total Elapsed Time = 4.850968 Seconds User+System Time = 4.747968 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 9.20 0.437 0.499 12 0.0364 0.0416 PDF::API2::Util::BEGIN 7.37 0.350 0.350 96795 0.0000 0.0000 PDF::API2::Basic::TTF::Table::read 7.27 0.345 0.345 3 0.1150 0.1150 main::parseHtml 5.73 0.272 0.609 9238 0.0000 0.0001 PDF::API2::Basic::TTF::Loca::read 4.91 0.233 0.341 21056 0.0000 0.0000 PDF::API2::Basic::TTF::Hhea::read 4.65 0.221 0.235 219 0.0010 0.0011 Exporter::import 3.90 0.185 0.904 21040 0.0000 0.0000 PDF::API2::Basic::TTF::Hmtx::read 3.64 0.173 0.329 825 0.0002 0.0004 PDF::API2::Matrix::multiply 3.54 0.168 1.214 44 0.0038 0.0276 PDF::API2::BEGIN 3.43 0.163 0.163 4689 0.0000 0.0000 PDF::API2::Basic::TTF::Glyph::new 3.37 0.160 0.228 21040 0.0000 0.0000 PDF::API2::Basic::TTF::Hmtx::_read 3.24 0.154 0.285 35204 0.0000 0.0000 PDF::API2::Basic::TTF::Maxp::read 3.14 0.149 0.149 14356 0.0000 0.0000 PDF::API2::Resource::CIDFont::True Type::fontfile 2.95 0.140 0.986 4646 0.0000 0.0002 PDF::API2::Resource::CIDFont::True Type::FontFile::subsetByCId 2.61 0.124 0.169 6 0.0207 0.0282 PDF::API2::Basic::TTF::Font::read Trimmed uniglyph.txt Total Elapsed Time = 5.336135 Seconds User+System Time = 5.282135 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 8.39 0.443 0.443 96795 0.0000 0.0000 PDF::API2::Basic::TTF::Table::read 7.33 0.387 0.730 9238 0.0000 0.0001 PDF::API2::Basic::TTF::Loca::read 6.68 0.353 0.551 21040 0.0000 0.0000 PDF::API2::Basic::TTF::Hmtx::_read 6.23 0.329 0.329 3 0.1097 0.1097 main::parseHtml 4.90 0.259 0.374 35204 0.0000 0.0000 PDF::API2::Basic::TTF::Maxp::read 4.75 0.251 0.888 44 0.0057 0.0202 PDF::API2::BEGIN 4.47 0.236 1.337 21040 0.0000 0.0001 PDF::API2::Basic::TTF::Hmtx::read 4.15 0.219 0.219 66057 0.0000 0.0000 PDF::API2::Resource::BaseFont::dat a 4.09 0.216 0.232 219 0.0010 0.0011 Exporter::import 3.56 0.188 0.251 21056 0.0000 0.0000 PDF::API2::Basic::TTF::Hhea::read 3.10 0.164 1.175 6 0.0274 0.1958 PDF::API2::Resource::CIDFont::True Type::FontFile::new 2.57 0.136 0.136 48792 0.0000 0.0000 PDF::API2::Resource::CIDFont::True Type::FontFile::data 2.56 0.135 0.135 4689 0.0000 0.0000 PDF::API2::Basic::TTF::Glyph::new 2.52 0.133 1.020 4646 0.0000 0.0002 PDF::API2::Resource::CIDFont::True Type::FontFile::subsetByCId 2.27 0.120 0.966 825 0.0001 0.0012 PDF::API2::Resource::CIDFont::text _cid Interesting thing. Without trimming the file, PDF::API2::Util::BEGIN takes 9.2% of the time in the execution, after trimming the file there is no entry for it. But, the execution time goes up a 1/2 second? Bill H