Faster check_install() #2

Merged
merged 3 commits into from Apr 27, 2012

Projects

None yet

2 participants

Contributor
vpit commented Apr 27, 2012

These three small commits make Module::Load::Conditional::check_install() do its job 30% faster for a typical module.

Since check_install() accounts for most of the time spent while CPANPLUS looks for modules to update, this helps making the "o" command run faster. On a medium-sized perl tree, I see a 10% gain. For a freshly-installed perl tree, the gains are negligible.

Vincent.

vpit added some commits Apr 25, 2012
@vpit vpit Optimize POD section handling in check_install()
By refactoring the regexps used to determine whether we are in POD, we can
save about 10% of the time spent in check_install() when CPANPLUS looks for
modules to update (check_install() being the bottleneck).
266af4c
@vpit vpit Only call _parse_version() for lines that contain VERSION
I.e. move the check for 'VERSION' from inside _parse_version() to the loop
of check_install(). This saves a function call for each source line that
does not contain 'VERSION', yielding a whopping 20% speedup for
check_install().

Note that _parse_version() still returns undef when the code chunk does
not contain 'VERSION', because the main regexp won't match.
1e68a8d
@vpit vpit No need to explicitely reset the $line at each iteration 68d124e
@bingos bingos merged commit 68d124e into jib:master Apr 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment