Skip to content

Add BlockedUnitRangeFirsts/Lasts to avoid allocating#509

Open
dlfivefifty wants to merge 11 commits into
masterfrom
dl/blockedfirstlasts
Open

Add BlockedUnitRangeFirsts/Lasts to avoid allocating#509
dlfivefifty wants to merge 11 commits into
masterfrom
dl/blockedfirstlasts

Conversation

@dlfivefifty

@dlfivefifty dlfivefifty commented Jul 2, 2026

Copy link
Copy Markdown
Member

This introduces a special type to avoid allocations in blockfirsts/blocklengths. It also removes a hack for ranged blocklasts that didn't work when the first index wasn't consistent by introducing a special range type FirstStepRangeLen when the first index matches the step.

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (81a9c1c) to head (579f2bc).

Files with missing lines Patch % Lines
src/firststeprangelen.jl 0.00% 52 Missing ⚠️
src/blockaxis.jl 0.00% 28 Missing ⚠️
src/blocks.jl 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (81a9c1c) and HEAD (579f2bc). Click for more details.

HEAD has 12 uploads less than BASE
Flag BASE (81a9c1c) HEAD (579f2bc)
13 1
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #509       +/-   ##
==========================================
- Coverage   94.39%   0.00%   -94.40%     
==========================================
  Files          19      20        +1     
  Lines        1821    1850       +29     
==========================================
- Hits         1719       0     -1719     
- Misses        102    1850     +1748     

☔ 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.

@dlfivefifty
dlfivefifty requested a review from mtfishman July 3, 2026 12:35
@dlfivefifty

Copy link
Copy Markdown
Member Author

@mtfishman it will be a while before the coverage is up and all the tests are passing. But perhaps you can have a preliminary look at this?

This is fixing two previous issues:

  1. blockfirsts and blocklengths were allocating. This was fixed via two new lazy types BlockedUnitRangeLengths and BlockedUnitRangeFirsts.
  2. This supports the case where all blocks have the same size via a new range FirstStepRangeLen to represent the block lasts, where the fact that the first index equals the step is hardcoded into the type. This replaces a very questionable temporary hack where I put a random @assert to check that the step and first match.

Any general thoughts about the design would be useful. I'm not convinced with my current naming scheme. And note that BlockedUnitRangeLengths could be called something like InvCumsum or ExtendedDiff as it's basically a lazy representation of diff([0; blocklasts]).

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.

1 participant