Skip to content

Instantly share code, notes, and snippets.

@jperkin
Last active April 28, 2020 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jperkin/98550d5bd07f4179ebfeea825fc3ec20 to your computer and use it in GitHub Desktop.
Save jperkin/98550d5bd07f4179ebfeea825fc3ec20 to your computer and use it in GitHub Desktop.

Improve performance and reliability of pkg_admin rebuild-tree

This patch:

  • Avoids duplicate entries in +REQUIRED_BY files.
  • Runs significantly faster, especially on systems with a large number of installed packages.

For example, on a system with 12,762 packages installed:

Version Wall Time User Time System Time Lines in */+REQUIRED_BY
Original 13m 52s 11m 20s 2m 32s 49,457
Patched 1m 4s 1m 3s 0m 1s 47,038
Unhashed[0] 1m 12s 1m 11s 0m 1s 47,038

[0]: Version of the patch using PKG_HASH_SIZE of 1, to show the performance improvement when using hashed lookups.

Proposed patch: https://github.com/joyent/pkgsrc/commit/426424c0ebbaadffa7db2c4e006418034065ae93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment