Skip to content

Use normalized names to distinguish unique distributions for performance#317

Merged
jaraco merged 3 commits intomainfrom
feature/faster-entry-points
May 27, 2021
Merged

Use normalized names to distinguish unique distributions for performance#317
jaraco merged 3 commits intomainfrom
feature/faster-entry-points

Conversation

@jaraco
Copy link
Copy Markdown
Member

@jaraco jaraco commented May 27, 2021

Fixes #283.

@anntzer Please have a look.

I found I couldn't use path.stem because path is a SimplePath and one implementation (zipfile.Path) doesn't implement stem.

I don't trust our benchmarks. Can you determine if this change has the performance benefit you were expecting?

@anntzer
Copy link
Copy Markdown
Contributor

anntzer commented May 27, 2021

This works super nicely, and locally I get a huge (nearly 10x) speedup 🎉

@jaraco
Copy link
Copy Markdown
Member Author

jaraco commented May 27, 2021

After further consideration, I do believe an OO solution may be better here... to allow a metadata provider to supply a fast version of the name normalization.

@jaraco jaraco merged commit e9f70d2 into main May 27, 2021
chrisjsewell added a commit to aiidateam/aiida-core that referenced this pull request Aug 12, 2021
This commit replaces the use of `reentry`, for entry point loading,
with `importlib_metadata` and, in turn,
removes the requirement for users to run `reentry scan` after installations.

aiida-core makes heavy use of entry-points to define plugins.
The `reentry` package was introduced to load these plugins since,
at the time, the de facto `pkg_resources` method for using entry points
was too slow, in particular for responsive CLI usage.
This, however, came with the drawback that users must perform an extra step
to register the plugins before aiida-core can be used, or when new plugins are installed.

In recent years `importlib.metadata` and its backport `importlib_metadata`
has replaced `pkg_resources`, and as of python/importlib_metadata#317
is now on a par with `reentry` for performance.

For now, we use `importlib_metadata` for all python versions,
rather than the built-in (as of python 3.8) `importlib.metadata`,
so that we can use the new python 3.10 API and performance boosts.
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.

Improve efficiency of entry-point parsing

2 participants