Skip to content

MOD-17912 Improve get_index performance - #1631

Merged
AvivDavid23 merged 2 commits into
masterfrom
MOD-17912
Aug 23, 2026
Merged

AvivDavid23 merged 2 commits into
masterfrom
MOD-17912

Conversation

@AvivDavid23

@AvivDavid23 AvivDavid23 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Note

Low Risk
Localized performance change to JSON array indexing with tests; no auth, data, or API contract changes. Typed elements now return owned values instead of iterator-produced ones, which should be equivalent.

Overview
Makes SelectValue::get_index for IValue O(1) on typed arrays instead of walking (and allocating) via iter().nth, which made full scans quadratic.

Indexing now uses the backing ArraySliceRef directly: heterogeneous arrays stay borrowed, typed numeric slices wrap the element in an owned IValue. Adds a unit test covering heterogeneous, F32, and I64 arrays plus out-of-range / non-array cases.

Also pins rust-analyzer in rust-toolchain.toml.

Reviewed by Cursor Bugbot for commit 6366955. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.97%. Comparing base (28f4bb1) to head (6366955).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1631   +/-   ##
=======================================
  Coverage   85.97%   85.97%           
=======================================
  Files          15       15           
  Lines        5305     5306    +1     
=======================================
+ Hits         4561     4562    +1     
  Misses        744      744           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AvivDavid23
AvivDavid23 merged commit 21568f4 into master Aug 23, 2026
61 of 62 checks passed
@AvivDavid23
AvivDavid23 deleted the MOD-17912 branch August 23, 2026 06:46
AvivDavid23 added a commit that referenced this pull request Aug 23, 2026
* MOD-17912 Improve `get_index` performance

* fmt

(cherry picked from commit 21568f4)
AvivDavid23 added a commit that referenced this pull request Aug 23, 2026
* MOD-17912 Improve `get_index` performance

* fmt

(cherry picked from commit 21568f4)
AvivDavid23 added a commit that referenced this pull request Aug 23, 2026
* MOD-17912 Improve `get_index` performance

* fmt

(cherry picked from commit 21568f4)
Test adapted to the 8.6 SelectValue API: get_long/get_double/as_str are
non-Option there, and JSONArrayType/get_array_type (V7 getArray, 8.8+) do not
exist, so the packed-array assertion uses ijson's ArraySliceRef::is_typed.
AvivDavid23 added a commit that referenced this pull request Aug 23, 2026
* MOD-17912 Improve `get_index` performance

* fmt

(cherry picked from commit 21568f4)
Test adapted to the 8.4 SelectValue API: get_long/get_double/as_str are
non-Option there, and JSONArrayType/get_array_type (V7 getArray, 8.8+) do not
exist, so the packed-array assertion uses ijson's ArraySliceRef::is_typed.
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.

2 participants