Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Performance penalties of in-Perl docn vs compiled CGIs.

by Discipulus (Canon)
on Feb 02, 2021 at 17:12 UTC ( [id://11127829] : note . print w/replies, xml ) Need Help??


in reply to Performance penalties of in-Perl docn vs compiled CGIs.

Hello phirun and welcome to the monastery,

you already had nice answers and a useful thread to read, just to add my 2 cents.

bliako is right with:

> Caveat: the motto "only Perl can parse Perl" very frequently pops up in these sort of questions.

But a perl document can be parsed by PPI and pod and comments easily removed

# the entire document: >perl -MPPI -e "print PPI::Document->new('example.pl')" use strict; use warnings; # safety net loaded my %ha = ( # dont use one letter variables 'ha' => 1, # this stand for.. 'he' => 2, # and this other for ); =pod =h4 documentation =cut print $ha{'ha'}."\n"; # other unuseful comment __END__ # the stripped document >perl -MPPI -e "$doc = PPI::Document->new('example.pl'); $doc->prune(' +PPI::Token::Pod'); $doc->prune('PPI::Token::Comment'); print $doc->se +rialize" use strict; use warnings; my %ha = ( 'ha' => 1, 'he' => 2, ); print $ha{'ha'}."\n"; __END__

So you can take a big enough perl document ( 1Mb ?) with lot of comments and pod, setup a non persistent weberver (with my limited experience I mean: a server which load the content at each request) and use ab to spot differences between serving the stripped and the complete document. Have fun ;)

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Performance penalties of in-Perl docn vs compiled CGIs.
by phirun (Novice) on Feb 02, 2021 at 20:33 UTC

    Thanks for the welcome, Discipulus, and to all who replied. A most interesting Brotherhood I'm glad to have found since I've never discussed or debated Perl before.

    The installed docn included with the package is so valuable and easy for self-instruction that seeking outside help always struck me as rather lazy. As always, times DO arise when some back-and-forth clears up odd points and the inevitable misconceptions. Now that I've decided to move outside my comfort zone that'll be more likely in future.

    I've copied off your document for experimenting. Much appreciated.