Commit Graph

24 Commits

Author SHA1 Message Date
Adam Reichold c644c0b0b8
Lazy-initialize the global reference pool to reduce its overhead when unused (#4178)
* Add benchmarks exercising the global reference count decrement pool.

* Lazy-initialize the global reference pool to reduce its overhead when unused
2024-06-06 08:45:16 +00:00
Adam Reichold c5f9001985
Remove deferred reference count increments and make the global reference pool optional (#4095)
* Add feature controlling the global reference pool to enable avoiding its overhead.

* Document reference-pool feature in the performance guide.

* Invert semantics of feature to disable reference pool so the new behaviour becomes opt-in

* Remove delayed reference count increments as we cannot prevent reference count errors as long as these are available

* Adjust tests to be compatible with disable-reference-pool feature

* Adjust tests to be compatible with py-clone feature

* Adjust the GIL benchmark to the updated reference pool semantics.

* Further extend and clarify the documentation of the py-clone and disable-reference-pool features

* Replace disable-reference-pool feature by pyo3_disable_reference_pool conditional compilation flag

Such a flag is harder to use and thereby also harder to abuse. This seems
appropriate as this is purely a performance-oriented change which show only be
enabled by leaf crates and brings with it additional highly implicit sources of
process aborts.

* Add pyo3_leak_on_drop_without_reference_pool to turn aborts into leaks when the global reference pool is disabled and the GIL is not held
2024-05-11 14:48:45 +00:00
David Hewitt 7d319a906e
ci: tidy up benchmarks a little (#3986) 2024-03-23 20:17:33 +00:00
Lily Foote 811a3e5d00
Add IntoIterator for &Bound types (#3923)
* Add IntoIterator for &Bound<'py, PyList>

* Add a test for Bound<'_, PyList>.into_iter

* Implement IntoIterator for more &Bound types

* Remove some explicit .iter() calls

* Implement IntoIterator for &Bound<'py, PyIterator>
2024-03-04 21:24:38 +00:00
David Hewitt 8a12970c96
update `extract_argument` to use Bound APIs (#3708)
* update `extract_argument` to use `Bound` APIs

* tidy up borrow in macros expression

* update `trybuild` output

* more concise form for `DowncastError::new`

Co-authored-by: Lily Foote <code@lilyf.org>

* use `Borrowed` instead of newtype

* use `Borrowed::from_ptr` methods in extract_argument

* update UI tests

* avoid double-negative `#[cfg]` clauses

Co-authored-by: Lily Foote <code@lilyf.org>

* review: LilyFoote, Icxolu feedback

---------

Co-authored-by: Lily Foote <code@lilyf.org>
2024-02-28 19:36:20 +00:00
David Hewitt 9e74c858c2
add `PyModule::new_bound` and `PyModule::import_bound` (#3775)
* add `PyModule::new` and `PyModule::import_bound`

* review: Icxolu feedback
2024-02-22 09:35:47 +00:00
David Hewitt 7a03a6fe6d
ci: disable some benchmarks volatile on codspeed (#3861) 2024-02-19 22:40:08 +00:00
David Hewitt 9a36b50789
update `py.import` -> `py.import_bound` in benches (#3868) 2024-02-19 22:15:36 +00:00
Icxolu c359f5ca1d
deprecate `PyDict::new` constructor (#3823)
* deprecate `PyDict::new`

* update benchmarks

* convert `test_frompyobject`
2024-02-11 23:55:56 +00:00
David Hewitt 2a741a21e6 migrate many `FromPyObject` implementations to `Bound` API 2024-02-04 14:22:03 +00:00
David Hewitt 76d1b34cd5 Revert "Merge pull request #3578 from davidhewitt/typed-helpers"
This reverts commit 7b07d6d21b, reversing
changes made to 99858236bd.
2024-02-03 20:56:23 +00:00
David Hewitt 0bb9de1aba remove bench of `GILPool::new` 2024-01-30 11:45:06 +00:00
David Hewitt c47565666d add `PyString::new_bound` 2024-01-29 13:14:00 +00:00
David Hewitt 345e122bbf add `PyFloat::new_bound` 2024-01-29 11:06:34 +00:00
David Hewitt 7927a2e211 add bench for tuple `get_borrowed_item` 2024-01-27 21:12:55 +00:00
David Hewitt 57a49a2b12 update tuple benchmarks for bound API 2024-01-27 21:12:55 +00:00
David Hewitt eed196329d add list bound constructors 2024-01-27 21:12:55 +00:00
David Hewitt 4e24e680e8 update set benchmarks 2024-01-17 10:49:21 +00:00
David Hewitt bd0174aa5d Change return types of `py.None()`, `py.NotImplemented()` and `py.Ellipsis()` to typed singletons 2023-11-17 16:16:19 +00:00
David Hewitt bf2c5a896b add codspeed benchmarks 2023-10-19 21:36:05 +01:00
David Hewitt 8a60540e25 amend code for `PyDict::get_item` change 2023-09-09 12:23:06 +01:00
Iliya Malecki 438d0a2b37 add benchmark for BigInt interaction 2023-08-17 08:15:50 +01:00
David Hewitt 496ddfe06e update criterion to 0.5.1 2023-07-30 07:36:47 +01:00
David Hewitt c2e8ba3c14 move benches to subdirectory 2023-07-30 07:36:47 +01:00