[cgiapp] size of scripts and dependencies

P Kishor punk.kish at gmail.com
Fri Sep 18 09:33:56 EDT 2009


On Fri, Sep 18, 2009 at 8:24 AM, Michael Graham <magog at the-wire.com> wrote:
>
> A bare Catalyst test app has about 87K lines.
>
> After you add all the plugins and support modules listed the tutorial
> (DBIx::Class, Template Toolkit, Session, Authentication, Authorization,
> FormFu) you're up to around 170K lines.


Cool! So, I am convinced that CGI::App and its bundle of plug-ins is
rather svelte compared to, say, Catalyst. But, now that we are done
comparing our overweight weight to a morbidly obese weight, how about
CGI::App on its own? To my completely uninformed mind, loading 40,000+
lines to create a small web page sounds like a lot... and, that
doesn't even include the web server and the Perl interpreter!

The other related issue is a single-piece install vs. lots of bits and
bobs. While the latter provides fine-grained control over what one
wants, lots of moving parts means lots of places things can go wrong.
I guess Titanium is a move toward that perception model of a
single-piece install, but Titanium is just a very thin skin holding a
lot of jingling jangling bones together.

Of course, a single-piece installation will presume certain
scaffolding for people, whether they like it or not, and provide
certain built-in ways of doing things, but if those ways meet the
needs of 80% of the people in an easy, single-click installation, one
piece to understand way, heck, we have 80% of customers as happy
customers, as happy spokespersons, etc.

One way to achieve this would be to simply squish all the various bits
and bobs into a single file and called CGI::Mongo. It will still be
40,000+ lines long, but heck, it would be a single file that will be
40,000+ lines long. The Perl interpreter will have to open only one
file on every invocation. Then, one can work on trimming what one
doesn't need.




>
>
> Michael
>
>
> On Tue, 15 Sep 2009 11:10:31 -0500
> P Kishor <punk.kish at gmail.com> wrote:
>
>> Pursuant to the recent email about Titanium dependency hell, I was
>> curious as to how big really was my tiny 20 line Perl index.cgi. So,
>> with guidance from a couple of monks on PM, I add the following line
>> to my script...
>>
>> END { system( 'wc', '-l', values %INC ) }
>>
>>
>>  and got the following (I have reverse sorted them by number of lines
>> of code)
>>
>>     7824 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBI.pm
>>     3900 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Simple.pm
>>     2449 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application.pm
>>     1535 /usr/local/lib/perl5/site_perl/5.8.8/Config/Simple.pm
>>     1473 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session.pm
>>     1472 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/JSON/XS.pm
>>     1434 /usr/local/lib/perl5/5.8.8/overload.pm
>>     1299 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Dispatch.pm
>>     1264 /usr/local/lib/perl5/5.8.8/darwin-2level/Data/Dumper.pm
>>      891 /usr/local/lib/perl5/site_perl/5.8.8/Exception/Class.pm
>>      872 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/DBD/SQLite.pm
>>      851 /Users/punkish/Sites/carbonmodel/app/_perl/Authen.pm
>>      833 /usr/local/lib/perl5/5.8.8/darwin-2level/DynaLoader.pm
>>      716 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/Params/Validate.pm
>>      614 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/LogDispatch.pm
>>      604 /usr/local/lib/perl5/5.8.8/CGI/Carp.pm
>>      566 /usr/local/lib/perl5/site_perl/5.8.8/Devel/StackTrace.pm
>>      543 /usr/local/lib/perl5/site_perl/5.8.8/JSON/Any.pm
>>      525 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/Session.pm
>>      516 /usr/local/lib/perl5/5.8.8/darwin-2level/File/Spec/Unix.pm
>>      497 /usr/local/lib/perl5/5.8.8/warnings.pm
>>      456 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Simple/Util.pm
>>      446 /usr/local/lib/perl5/site_perl/5.8.8/Crypt/GeneratePassword.pm
>>      440 /usr/local/lib/perl5/5.8.8/Exporter.pm
>>      437 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch.pm
>>      376 /usr/local/lib/perl5/5.8.8/darwin-2level/Digest/MD5.pm
>>      356 /usr/local/lib/perl5/5.8.8/Time/Local.pm
>>      356 /usr/local/lib/perl5/5.8.8/darwin-2level/XSLoader.pm
>>      343 /usr/local/lib/perl5/5.8.8/AutoLoader.pm
>>      340 /usr/local/lib/perl5/5.8.8/constant.pm
>>      336 /usr/local/lib/perl5/5.8.8/darwin-2level/File/Spec.pm
>>      327 /usr/local/lib/perl5/site_perl/5.8.8/Exception/Class/TryCatch.pm
>>      316 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/DBH.pm
>>      301 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Output.pm
>>      283 /usr/local/lib/perl5/5.8.8/darwin-2level/Scalar/Util.pm
>>      274 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/JSON.pm
>>      274 /usr/local/lib/perl5/5.8.8/Carp.pm
>>      263 /usr/local/lib/perl5/5.8.8/Text/ParseWords.pm
>>      259 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/File.pm
>>      248 /usr/local/lib/perl5/5.8.8/Exporter/Heavy.pm
>>      236 /usr/local/lib/perl5/5.8.8/darwin-2level/Fcntl.pm
>>      235 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Application/Plugin/Config/Simple.pm
>>      233 /usr/local/lib/perl5/5.8.8/darwin-2level/List/Util.pm
>>      226 /usr/local/lib/perl5/5.8.8/base.pm
>>      214 /usr/local/lib/perl5/5.8.8/Class/ISA.pm
>>      206 /usr/local/lib/perl5/5.8.8/darwin-2level/lib.pm
>>      204 /usr/local/lib/perl5/site_perl/5.8.8/common/sense.pm
>>      194 /usr/local/lib/perl5/site_perl/5.8.8/UNIVERSAL/require.pm
>>      160 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/Params/ValidateXS.pm
>>      151 /usr/local/lib/perl5/site_perl/5.8.8/Class/Data/Inheritable.pm
>>      147 /usr/local/lib/perl5/5.8.8/UNIVERSAL.pm
>>      136 /usr/local/lib/perl5/5.8.8/strict.pm
>>      131 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Screen.pm
>>      127 /Users/punkish/Sites/carbonmodel/app/_perl/Carbonmodel.pm
>>      100 /usr/local/lib/perl5/5.8.8/Digest/base.pm
>>       95 /usr/local/lib/perl5/5.8.8/darwin-2level/Config.pm
>>       93 /usr/local/lib/perl5/5.8.8/integer.pm
>>       88 /usr/local/lib/perl5/5.8.8/bytes.pm
>>       82 /usr/local/lib/perl5/5.8.8/vars.pm
>>       73 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/ErrorHandler.pm
>>       63 /usr/local/lib/perl5/site_perl/5.8.8/Log/Dispatch/Base.pm
>>       51 /usr/local/lib/perl5/5.8.8/warnings/register.pm
>>       418 /usr/local/lib/perl5/5.8.8/attributes.pm
>>       40 /usr/local/lib/perl5/5.8.8/locale.pm
>>       23 /usr/local/lib/perl5/site_perl/5.8.8/auto/Config/Simple/autosplit.ix
>>       13 /usr/local/lib/perl5/site_perl/5.8.8/auto/Config/Simple/verbose.al
>>
>>
>>    40848 total
>>
>>
>> So, 40K lines of code to create a fairly routine website, and that is
>> not counting any HTML/SQL/JavaScript and CSS. Granted, this is fairly
>> misleading as it includes formatting of lines, comments, etc., but
>> still... is this par for course for other frameworks as well?
>>
>>
>>
>
>
> --
> Michael Graham <magog at the-wire.com>
>




-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
Sent from Madison, WI, United States


More information about the cgiapp mailing list