Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vectors: avoid expensive comparisons between numpy ints and Python ints #10992

Merged

Conversation

danieldk
Copy link
Contributor

Description

Avoid expensive comparisons between numpy ints and Python ints when mapping hashes to rows in the embedding table. When doing some repeated benchmarks, this seems to improve performance by 800-900WPS on an 5950X.

Types of change

Performance improvement.

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

@svlandeg svlandeg added enhancement Feature requests and improvements feat / vectors Feature: Word vectors and similarity perf / speed Performance: speed labels Jun 20, 2022
@svlandeg
Copy link
Member

@danieldk : could you have a look into the failing test?

spacy/vectors.pyx Outdated Show resolved Hide resolved
@adrianeboyd adrianeboyd merged commit 0ff14aa into explosion:master Jun 29, 2022
polm pushed a commit that referenced this pull request Jul 11, 2022
…ts (#10992)

* vectors: avoid expensive comparisons between numpy ints and Python ints

* vectors: avoid failure on lists of ints

* Convert another numpy int to Python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and improvements feat / vectors Feature: Word vectors and similarity perf / speed Performance: speed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants