Bug 15006

Summary: Improve performance of the pkg_hash_fetch_best_installation_candidate function.
Product: [Yocto Project Subprojects] opkg Reporter: Alex Stewart <alex.stewart>
Component: opkgAssignee: Alex Stewart <alex.stewart>
Status: ACCEPTED --- QA Contact:
Severity: enhancement    
Priority: Undecided    
Version: 0.6.1   
Target Milestone: next-patch   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Alex Stewart 2023-01-13 08:04:11 UTC
This enhancement request was moved from the project's `:TODO` file, and was originally authored by Graham Gower.

pkg_hash_fetch_best_installation_candidate() is linear search O(P*PN)
and is slow (frequently called).
    P provider
    PN pkgs in a provider

It can be O(P) if a hash table is used.

https://git.yoctoproject.org/opkg/tree/libopkg/pkg_hash.c?id=cee294e72d257417b5e55ef7a76a0fd15313e46b#n335