Paul Seamons > CGI-Ex-2.38 > memory_app.pl

Download:
CGI-Ex-2.38.tar.gz

Annotate this POD

CPAN RT

New  4
Open  0
View/Report Bugs
Source   Latest Release: CGI-Ex-2.41

NAME ^

memory_app.pl - Test memory usage and benchmark speed comparison with CGI::Application

NOTES ^

Abbreviations:

  C::E::A - CGI::Ex::App
  C::A    - CGI::Application

The tests are currently run with the following code:

  use Template::Alloy load => 'Parse', 'Play', 'HTML::Template', 'Template';

This assures that CGI::Application will use the same templating system as CGI::Ex::App so that template system issues don't affect overall performance. With the line commented out and CGI::Application using HTML::Template (ht), C::A has a slight speed benefit, though it still uses more memory. With the line commented out and CGI::Application using Template (tt), C::E::A is 2 to 3 times faster and uses a lot less memory.

SAMPLE OUTPUT ^

  paul     23927  4.3  0.5   8536  6016 pts/1    S+   11:36   0:00  |       \_ perl samples/devel/memory_app.pl
  paul     23928  1.0  0.5   8988  5992 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - C::A - bare
  paul     23929  2.0  0.6   9988  7152 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - C::A - complex ht
  paul     23930  2.5  0.7  10172  7336 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - C::A - complex tt
  paul     23931  1.0  0.5   8988  6024 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - C::A - simple ht
  paul     23932  1.5  0.6   9308  6276 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - C::A - simple tt
  paul     23933  0.0  0.5   8536  5200 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - C::E::A - bare
  paul     23934  1.0  0.6   9328  6384 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - C::E::A - complex ht
  paul     23935  1.0  0.6   9328  6392 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - C::E::A - complex tt
  paul     23936  0.0  0.5   8536  5272 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - C::E::A - simple ht
  paul     23937  0.0  0.5   8668  5344 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - C::E::A - simple tt
  paul     23938  0.0  0.4   8536  5076 pts/1    S+   11:36   0:00  |           \_ samples/devel/memory_app.pl - Handwritten - bare
  -------------------------------------------------
  --- Testing bare
  Benchmark: running C::A -, C::E::A -, Handwritten - for at least 2 CPU seconds...
      C::A -:  3 wallclock secs ( 2.08 usr +  0.01 sys =  2.09 CPU) @ 3196.17/s (n=6680)
   C::E::A -:  3 wallclock secs ( 1.99 usr +  0.19 sys =  2.18 CPU) @ 6164.68/s (n=13439)
  Handwritten -:  1 wallclock secs ( 2.15 usr +  0.00 sys =  2.15 CPU) @ 266711.16/s (n=573429)
                    Rate        C::A -     C::E::A - Handwritten -
  C::A -          3196/s            --          -48%          -99%
  C::E::A -       6165/s           93%            --          -98%
  Handwritten - 266711/s         8245%         4226%            --
  -------------------------------------------------
  --- Testing simple
  Benchmark: running C::A - ht, C::A - tt, C::E::A - ht, C::E::A - tt for at least 2 CPU seconds...
   C::A - ht:  2 wallclock secs ( 2.04 usr +  0.00 sys =  2.04 CPU) @ 709.80/s (n=1448)
   C::A - tt:  2 wallclock secs ( 2.12 usr +  0.01 sys =  2.13 CPU) @ 600.47/s (n=1279)
  C::E::A - ht:  2 wallclock secs ( 2.14 usr +  0.01 sys =  2.15 CPU) @ 663.26/s (n=1426)
  C::E::A - tt:  3 wallclock secs ( 2.16 usr +  0.01 sys =  2.17 CPU) @ 589.40/s (n=1279)
                Rate C::E::A - tt    C::A - tt C::E::A - ht    C::A - ht
  C::E::A - tt 589/s           --          -2%         -11%         -17%
  C::A - tt    600/s           2%           --          -9%         -15%
  C::E::A - ht 663/s          13%          10%           --          -7%
  C::A - ht    710/s          20%          18%           7%           --
  -------------------------------------------------
  --- Testing complex
  Benchmark: running C::A - ht, C::A - tt, C::E::A - ht, C::E::A - tt for at least 2 CPU seconds...
   C::A - ht:  2 wallclock secs ( 2.00 usr +  0.00 sys =  2.00 CPU) @ 438.50/s (n=877)
   C::A - tt:  3 wallclock secs ( 2.16 usr +  0.00 sys =  2.16 CPU) @ 383.80/s (n=829)
  C::E::A - ht:  2 wallclock secs ( 2.14 usr +  0.01 sys =  2.15 CPU) @ 457.21/s (n=983)
  C::E::A - tt:  2 wallclock secs ( 2.13 usr +  0.00 sys =  2.13 CPU) @ 417.37/s (n=889)
                Rate    C::A - tt C::E::A - tt    C::A - ht C::E::A - ht
  C::A - tt    384/s           --          -8%         -12%         -16%
  C::E::A - tt 417/s           9%           --          -5%          -9%
  C::A - ht    438/s          14%           5%           --          -4%
  C::E::A - ht 457/s          19%          10%           4%           --
syntax highlighting: