-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance: Cache the lookup of entry points (#6124)
Entry points are looked up using the `entry_points` callable of the `importlib_metadata` module. It is wrapped by the `eps` function in the `aiida.plugins.entry_point` module. This call, and the `.select()` filter that is used on it to find a specific entry point can be quite expensive as it involves a double loop in the `importlib_metadata` code. Since it is used throughout the `aiida-core` source code whenever an entry point is looked up, this causes a significant slowdown of module imports. The `eps` function now pre-sorts the entry points based on the group. This guarantees that the entry points of groups starting with `aiida.` come first in the lookup, giving a small performance boost. The result is then cached so the sorting is performed just once, which takes on the order of ~30 µs. The most expensive part is still the looping over all entry points when `eps().select()` is called. To alleviate this, the `eps_select` function is added which simply calls through to `eps().select()`, but which allows the calls to be cached. In order to implement the changes, the `importlib_metadata` package, which provides a backport implementation of the `importlib.metadata` module of the standard lib, was updated to v6.0.
- Loading branch information
1 parent
2ea5087
commit 12cc930
Showing
10 changed files
with
68 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters