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

Update to Pyo3 0.21 #7

Merged
merged 7 commits into from May 16, 2024
Merged

Conversation

Dr-Emann
Copy link
Contributor

@Dr-Emann Dr-Emann commented Mar 20, 2024

@Dr-Emann Dr-Emann changed the title WIP Pyo3 0.21 Bound API Update to Pyo3 0.21 Apr 2, 2024
@Dr-Emann Dr-Emann marked this pull request as ready for review April 2, 2024 00:53
@Dr-Emann
Copy link
Contributor Author

Dr-Emann commented Apr 2, 2024

The benchmark appears to show a slight increase in performance for me, mostly when doing .update with a list or an iterable

@KenanHanke I had to update the CI to fix an issue with the macos build, and while I was at it, I went ahead and took most of the suggested updated CI config from maturin generate-ci github, let me know if you don't like any of the changes.

[docs](https://pyo3.rs/v0.21.1/performance#extract-versus-downcast) suggest
this is faster, and can lead to better error messages in the
`bloom.update(bloom)` case: before, `extract::<PyRef<Bloom>>()` would fail, so
we would fall back to trying (and failing) to iterate the Bloom object. Now,
instead, we get a clear error that `bloom` is already borrowed mutably.

We could instead take `&Bound<'_, Bloom>`, and check `slf.is(other)` before
borrowing, to avoid the error entirely, but it makes the signature and body of
the functions a fair bit uglier, not sure if it's worth it.
Per [maturin PR](PyO3/maturin#1620), use
`--target universal2-apple-darwin` instead
Allow gc to collect a Bloom object even if the hash function contains a
reference to the Bloom filter

We don't have to implement `__clear__`, because our reference is immutable, it
will be set in `__new__` and never modified. Reference cycles must include at
least one mutable reference, so allow the hash_func object's __clear__ to break
the cycle
@KenanHanke KenanHanke merged commit be7b67e into KenanHanke:main May 16, 2024
7 checks passed
@Dr-Emann Dr-Emann deleted the pyo3_0.21_bound_prep branch May 16, 2024 17:17
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.

None yet

2 participants