Microblogi: A very long article Wikipedia article on the orientation of toilet paper [7. kes klo 22:52] [V]

Tiistai, 8. toukokuuta 2007

Even Faster!

Käännös: [ Google ]

Kategoriat: [ Blogi ]

I dug again into my hacked blosxom to find more ugliness, such as opening files for all the stories, including the ones that are not going to be displayed. This divided the time spent in blosxom::generate by 3.

Surprisingly, replacing the look-behind assertions in interpolate_fancy::__ANON__'s regexps didn't made as big a difference as in textrite::rite (1.11 ms against 0.813 ms), probably because there wasn't that many of them and weren't called that often

Profiling results are now like this:

Total Elapsed Time = 1.236275 Seconds
  User+System Time = 1.066275 Seconds
Exclusive Times
 %Time ExclSec CumulS  #Calls sec/call Csec/c Name
  10.2   0.109 0.127     134   0.0008 0.0010 interpolate_fancy::__ANON__
  7.50   0.080 0.178      13   0.0061 0.0137 blosxom::BEGIN
  5.06   0.054 0.428       1   0.0540 0.4283 blosxom::generate
  4.41   0.047 0.098     368   0.0001 0.0003 entries_index::__ANON__
  3.75   0.040 0.040       7   0.0057 0.0057 CGI::_compile
  3.75   0.040 0.054       9   0.0044 0.0061 CGI::import
  3.75   0.040 0.040      40   0.0010 0.0010 textrite::rite
  3.66   0.039 0.039     690   0.0001 0.0001 File::Basename::fileparse
  2.81   0.030 0.060       8   0.0037 0.0074 Net::SMTP::BEGIN
  2.81   0.030 -0.000     62   0.0005      -  Exporter::import
  2.81   0.030 0.030      40   0.0007 0.0007 magiclink::story
  1.88   0.020 0.020       5   0.0040 0.0040 autotrack::BEGIN
  1.88   0.020 0.030       7   0.0029 0.0042 IO::File::BEGIN
  1.88   0.020 0.089       8   0.0025 0.0111 writeback::BEGIN
  1.88   0.020 0.020      41   0.0005 0.0005 writeback::real_path

The User+System Time is lower, but for some reason the Total Elapsed Time is about the same.

[ Postattu 8. toukokuuta 2007 klo 22.42 | ei kommenttia | ]

Profiling 2

Käännös: [ Google ]

Kategoriat: [ Blogi ]

Profiling results for the new blog engine (main page):

Total Elapsed Time = 1.245757 Seconds
  User+System Time = 1.235757 Seconds
Exclusive Times
 %Time ExclSec CumulS  #Calls sec/call Csec/c Name
  14.9   0.185 0.586       1   0.1851 0.5857 blosxom::generate
  12.0   0.149 0.187     134   0.0011 0.0014 interpolate_fancy::__ANON__
  6.47   0.080 0.158      14   0.0057 0.0113 blosxom::BEGIN
  5.66   0.070 0.070      40   0.0017 0.0017 textrite::rite
  4.53   0.056 0.095     367   0.0002 0.0003 entries_index::__ANON__
  4.05   0.050 0.059       8   0.0062 0.0074 Net::SMTP::BEGIN
  3.24   0.040 0.108       8   0.0050 0.0135 writeback::BEGIN
  2.43   0.030 0.030       7   0.0043 0.0043 CGI::_compile
  2.43   0.030 0.043       9   0.0033 0.0048 CGI::import
  2.27   0.028 0.037     317   0.0001 0.0001 interpolate_fancy::_resolve_nested
  1.62   0.020 0.020       1   0.0200 0.0200 archives::filter
  1.62   0.020 0.019       4   0.0050 0.0048 entries_index::BEGIN
  1.62   0.020 0.030       5   0.0040 0.0060 autotrack::BEGIN
  1.62   0.020 0.020      27   0.0007 0.0007 vars::import
  1.62   0.020 0.010      62   0.0003 0.0002 Exporter::import

The problem in textrite::rite came from the use of look-behind assertions in Perl regexp. I've changed all of them so that look-behind is not needed anymore. The same problem occurs in interpolate_fancy::__ANON__, but I'm not going to look into it yet.

The other problem was that textrite::rite was called for all the stories, including the ones that were not displayed (which was most of them). I changed the internal structure of the main script so that the processing of the story happens after discarding the non-displayed ones.

[ Postattu 8. toukokuuta 2007 klo 12.25 | ei kommenttia | ]