http://qs1969.pair.com?node_id=11138180


in reply to When does it make sense to preload modules when starting Starman?

preloading in general makes sense when you are able to amortize the upfront penalty from start up over the lifetime of the running application. So if you have a highly stable application that's never restarted, then it's probably worth a few minutes of "warm up" time at the start. If you're going to be restarting often or the preload is simply too much work for the reward, then you're better off lazily loading at runtime via require.

Update - I thought I should add what I knew to be true (at some point) and isn't a secret, cPanel pays people a a lot of money to maintain a build infrastructure that uses B::C to generate a binary from Perl simply to improve start up time of their administrative daemon, cpservd. Basically, many MBs of initializations and module loads are shoved into a BEGIN{}. The binary is the state of the perl start up through BEGIN (like what you get by invoking perl -c). My point is that this is also an option - if you have a lot of stuff to preload, B::C can be used to get you into a state where start up actually picks up after BEGIN.