0

I am trying to find some online tool for compressing and optimizing my perl. Is there any benefit to removal of (at a minimum) whitespace and comments from server side cgi?

harmonic
  • 59
  • 3
  • 9
  • Why do you want to do this? What are your performance issues? How do you deliver your cgi, what webserver do you use? – matthias krull Mar 10 '12 at 16:19
  • I use Apache2, but I'm not sure what you mean by how I deliver? I just want to reduce the wait time (between request and response of index.cgi) – harmonic Mar 10 '12 at 16:41

2 Answers2

7

Perl source undergoes a compilation phase, it is not directly interpreted. Perl code is executed at the server, not delivered to the client. Unlike JavaScript, there is no benefit from minimisation.

If you want to optimise, measure first where the bottle-neck is. I presume that switching from CGI to a persistent technology will give you a big pay-off.

Related:


Edit:

You mention in a comment that you deploy on Apache httpd. To reduce start-up time without changing existing code, install mod_perl2 and run your CGI programs with the perl-script handler. In the long term, switch over your code base from CGI to PSGI and deploy on Plack::Handler::Apache2, or preferably, if you also have an FastCGI adapter for the web server, Plack::Handler::Net::FastCGI.

Community
  • 1
  • 1
daxim
  • 39,270
  • 4
  • 65
  • 132
0

Perltidy is a free pretty-printer with a lot of options. Some of them might do what you want in some way, remove whitespace for instance. It's not a minifier, but good to know nevertheless, I'd recommend to add it to your toolchest

knb
  • 9,138
  • 4
  • 58
  • 85