Skip to content

perf: test field-name slices before integer-like slices - #4344

Merged
ianna merged 1 commit into
scikit-hep:mainfrom
ikrommyd:perf-improve-content-getitem
Sep 13, 2026
Merged

ianna merged 1 commit into
scikit-hep:mainfrom
ikrommyd:perf-improve-content-getitem

Conversation

@ikrommyd

Copy link
Copy Markdown
Member

Content._getitem tested is_integer_like before the str case, so slicing by field name paid an ABC check and three hasattr calls first. Field names are the most common slice.

@github-actions github-actions Bot added the type/perf PR title type: perf (set automatically) label Sep 12, 2026
@codecov

codecov Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.40%. Comparing base (6fef070) to head (610e255).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
Files with missing lines Coverage Δ
src/awkward/contents/content.py 51.30% <100.00%> (ø)

... and 1 file with indirect coverage changes

github-actions Bot added a commit that referenced this pull request Sep 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The documentation preview is ready to be viewed at https://awkward-array.org/doc/pr/4344/

@ikrommyd
ikrommyd marked this pull request as ready for review September 13, 2026 10:36

@ianna ianna left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very low risk. Checking str before the more expensive integer-like machinery is semantically clean and fully covered.

@ianna
ianna merged commit f82b134 into scikit-hep:main Sep 13, 2026
39 checks passed
github-actions Bot added a commit that referenced this pull request Sep 13, 2026
@ikrommyd
ikrommyd deleted the perf-improve-content-getitem branch October 19, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/perf PR title type: perf (set automatically)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants