Using perl-module-startup-time.pl I'm able to calculate the startup time for Path::Tiny (no methods called, just loading the module) at 15.8ms. As a comparison here are some other modules on the same system.
File::Basename adds 3.1 ms to startup time
Time::HiRes adds 1.5 ms to startup time
Getopt::Long adds 9.9 ms to startup time
Data::Dumper adds 8.9 ms to startup time
That majority of the startup time in Path::Tiny is spent loading Carp and File::Spec. File::Spec is only used in rootdir(). Changing these two modules to load on-demand drops the startup time to 10.4ms. This is a ~34% improvement in startup time.
Before I go to the trouble of writing up a full PR is this something you'd consider accepting? Attached is a rough patch of the concept.
path-tiny-lazy-load.patch.gz
Using perl-module-startup-time.pl I'm able to calculate the startup time for
Path::Tiny(no methods called, just loading the module) at 15.8ms. As a comparison here are some other modules on the same system.That majority of the startup time in
Path::Tinyis spent loadingCarpandFile::Spec.File::Specis only used inrootdir(). Changing these two modules to load on-demand drops the startup time to 10.4ms. This is a ~34% improvement in startup time.Before I go to the trouble of writing up a full PR is this something you'd consider accepting? Attached is a rough patch of the concept.
path-tiny-lazy-load.patch.gz