Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid instantiating Safe compartment if operating in "unsafe" mode. #12

Merged

Conversation

bleargh45
Copy link
Contributor

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 (via cpm), and finding that a substantial amount of
overhead was involved in simply instantiating/initializing the Safe
compartment, even when Parse::PMFile was being used in UNSAFE => 1
mode.

While for many distributions, the overhead involved here would be
negligible, for Paws (with over 20k .pm files), the overhead becomes
substantial.

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

When operating in "unsafe" mode, the `$comp` never ends up getting used.
So, why even 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` (via `cpm`), and finding that a substantial amount of
overhead was involved in simply instantiating/initializing the `Safe`
compartment, even when `Parse::PMFile` was being used in `UNSAFE => 1`
mode.

While for many distributions, the overhead involved here would be
negligible, for `Paws` (with over 20k `.pm` files), the overhead becomes
substantial.

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
@charsbar charsbar merged commit d11dd63 into charsbar:master Dec 11, 2020
@charsbar
Copy link
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants