This speeds up things vastly when a slow die handler (e.g. \&Carp::confess)
is set.
return 0 if $INC{$pm}; # already loaded
local $@;
return 0 if $INC{$pm}; # already loaded
local $@;
- eval { require $pm; 1 };
+ eval {
+ # We die often here, even though we're not really interested in the error.
+ # However, if a die handler is set (e.g. to \&Carp::confess), this can get
+ # very slow. Resetting the handler shows a 10% total time improvement for the
+ # geodyn app.
+ local $SIG{__DIE__};
+ require $pm;
+ };