evan_tech

Previous Entry Share Next Entry
12:33 pm, 1 Dec 07

gitweb/perl speed

gitweb is nice but slow -- about 400ms to produce the index page for a directory that contains only one project. (Not really worth running mod_perl for, y'know?) By unfair contrast, Google's memory-resident server provides me search results in about 150ms, including HTTP transfer time.

About 200ms of gitweb's runtime seems to be Perl startup time, which I gauged by measuring a simple script that just imports the same things gitweb does and exits immediately. It opens 33 files from directories with "perl" in their name, mostly .pms but a couple .sos as well. Is there a way to "prelink" a perl program?

Perl spends another 140ms around calls to read() on the gitweb script. I guess it's probably parsing at the same time? (The script is 160k(!) of perl code.) I found you can run perlcc -B foo.cgi to produce bytecode, which speeds things up by a bit over 100ms. (Without the -B flag it tries to compile via C and aborts with some internal failure message. The manpage for the package has lots of scary-looking "do not use this for production" messages.) But the module loads are still external, and continue to dominate the startup time.