Avoid instantiating Safe
compartment if operating in "unsafe" mode.
#12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When operating in "unsafe" mode, the
$comp
compartment never gets used.So, why instantiate/initialize it if we know that we're not going to be needing it?
This patch results from an examination of the time spent performing an
install of
Paws
(viacpm
), and finding that a substantial amount ofoverhead was involved in simply instantiating/initializing the
Safe
compartment, even when
Parse::PMFile
was being used inUNSAFE => 1
mode.
While for many distributions, the overhead involved here would be
negligible, for
Paws
(with over 20k.pm
files), the overhead becomessubstantial.
Rough timings with
cpm install --verbose Paws
...Upstream:
16041 DONE resolve (0.477sec) Paws -> Paws-0.42 (from MetaDB)
16041 DONE fetch (19.435sec) Paws-0.42
16041 DONE configure (25.846sec) Paws-0.42
16041 DONE install (40.388sec) Paws-0.42
With Patch:
72651 DONE resolve (0.455sec) Paws -> Paws-0.42 (from MetaDB)
72651 DONE fetch (6.140sec) Paws-0.42
72651 DONE configure (4.488sec) Paws-0.42
72651 DONE install (41.798sec) Paws-0.42