PERF: avoid materializing values[indexer] in Block.setitem#64251
Merged
jbrockmendel merged 10 commits intoApr 10, 2026
Merged
Conversation
Closed
3 tasks
Contributor
Author
|
ASV results for this change (same machine, same env): asv run -e -E existing -b SetitemObjectDtypeDatetimelike --record-samples --dry-runNote: for apples-to-apples comparison, baseline was measured by reverting only the optimization in
Geometric mean speedup:
|
rhshadrach
previously requested changes
Feb 20, 2026
Contributor
Author
|
Pushed follow-up commit
|
Member
|
Can you add a whatsnew for the perf improvement? otherwise LGTM |
Contributor
Author
|
Added a whatsnew entry in |
jbrockmendel
approved these changes
Mar 26, 2026
Member
|
thanks @hyoj0942 |
Sharl0tteIsTaken
added a commit
to Sharl0tteIsTaken/pandas
that referenced
this pull request
Apr 12, 2026
…-comparison * upstream/main: PERF: use lookup instead of hash_inner_join for merge with unique right keys (pandas-dev#64691) BUG : update `SeriesGroupBy.ohlc()` to honor `as_index=False` (pandas-dev#65141) PERF: Use DataFrame-level reductions in DataFrame.agg with list of funcs (pandas-dev#65031) DOC: document required external libraries in read_* I/O docstrings (pandas-dev#65143) DOC: improve MultiIndex.is_monotonic_increasing/decreasing docstrings (pandas-dev#65154) BUG: Raise ValueError for non-boolean numeric_only in DataFrame/Series reductions (GH#53098) (pandas-dev#65131) BUG: Timedelta.round() raises ZeroDivisionError when internal unit is 's' and target frequency is sub-second (pandas-dev#64836) ENH: Add replace method to Index (closes pandas-dev#19495) (pandas-dev#65099) PERF: improve StringArray.isna (pandas-dev#57733) BUG: read parquet files with older pytz (DEP: keep lower pytz minimum version) (pandas-dev#65133) DEPR: deprecate dates-with-datetime64 in _maybe_downcast_for_indexing (pandas-dev#64871) DOC: note that DataFrame.values is not writeable (pandas-dev#65142) CLN: Update groupby observed defaults (pandas-dev#65148) PERF: avoid materializing values[indexer] in Block.setitem (pandas-dev#64251) DOC: update GroupBy.sum/min/max See Also sections (pandas-dev#65144)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.AGENTS.md.This avoids materializing
values[indexer]in the object-dtype datetimelike compatibility path ofBlock.setitem.Changes:
length_of_indexerfor common indexer types instead of materializingvalues[indexer]len(values[indexer])whatsnewentry for the performance improvementValidation run locally:
python -m pytest pandas/tests/indexing/test_iloc.py -k "test_iloc_setitem_custom_object"python -m pre_commit run --files pandas/core/internals/blocks.pypython -m pre_commit run --files doc/source/whatsnew/v3.1.0.rst