Skip to content

Avoid redundant normalization when transforming strided views - #58

Merged
lkdvos merged 2 commits into
mainfrom
ld-view-constructor-overhead
Oct 9, 2026
Merged

lkdvos merged 2 commits into
mainfrom
ld-view-constructor-overhead

Conversation

@lkdvos

@lkdvos lkdvos commented Oct 7, 2026

Copy link
Copy Markdown
Member

Reuse normalized parents when transforming existing views. Operation-only transformations and equal-size reinterpretation also reuse strides; permutations, slices, and reshapes retain stride normalization. Return the existing view for a same-shape sreshape.

Small Julia 1.13.1 / BenchmarkTools measurements on StridedView(zeros(ComplexF64, 8, 9, 10, 11)) (minimum of 1,000 samples):

Operation Before After
conj(a) 7.5 ns 6.2 ns
permutedims(a, (4, 2, 1, 3)) 17.3 ns 17.1 ns
sreshape(a, size(a)) 67.1 ns 10.5 ns

All cases remain allocation-free. The permutation retains normalization, so its timing is effectively unchanged.

Validated 1,321 existing CPU checks and 266 focused layout checks, including negative strides, offsets, singleton/empty axes, and rank changes.

Comment thread src/stridedview.jl Outdated
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.36842% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/stridedview.jl 47.36% 10 Missing ⚠️
Files with missing lines Coverage Δ
src/stridedview.jl 29.51% <47.36%> (+1.66%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Instead of calling the fully parameterized inner constructor at every
call site that reuses an already-normalized parent, let the outer
`StridedView`/`StridedView{T}` constructors take `normalize = false`
to skip parent and stride normalization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lkdvos
lkdvos enabled auto-merge (squash) October 8, 2026 23:09
@lkdvos
lkdvos requested a review from Jutho October 8, 2026 23:09
@lkdvos
lkdvos merged commit 2c0be41 into main Oct 9, 2026
11 of 14 checks passed
@lkdvos
lkdvos deleted the ld-view-constructor-overhead branch October 9, 2026 08:12
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