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.cgito 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.