spkenv / spk

A Package Manager for high velocity software environments, built on spfs.
https://spkenv.dev
Apache License 2.0
40 stars 6 forks source link

Fix poor performance of to_tracking_manifest #1047

Closed jrray closed 5 months ago

jrray commented 5 months ago

This method had something like O(n^3) complexity because it would for every tree in a manifest iterate over every tree in a manifest and calculate the digest for every tree in the manifest (modulo short circuiting).

Manifest::get_tree is the culprit and an alternative technique of caching the mapping of digest to tree was added. Both uses of this method have been updated but this method was left in place with a new warning. It would be cheaper to call get_tree in a contrived case where the cache is only accessed once and not reused for multiple lookups.

Fixes #1043.