Skip to content

Current region: grow past 10,000 rows, in linear time - #151

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
nihilist-narwhal:fix-current-region
Oct 10, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
nihilist-narwhal:fix-current-region

Conversation

@nihilist-narwhal

Copy link
Copy Markdown
Contributor

selection::current_region is the range Ctrl+A, sort, filter, AutoSum, tables and Get Data use when one cell is selected. It grew the region by one ring of cells per step, rescanning every stored cell inside the ring each time, and gave up after 10,000 steps. With 20,000 rows of data in A1:B20001 and A2 selected, data.sortDescending sorted only rows 2–10,002 and left the rest as they were (A2 became 10001, not 20000). A 100,000-row region took 30 s and was cut at row 10,001.

It now grows one side at a time while the line next to that side has data (diagonals included), checking only the cells of that line, with no step limit. The same 100,000 × 100 region takes well under a second.

  • The new assertion in selection::tests::regions (20,000 rows) fails before the change (A1:B10006).
  • fmt, clippy (apart from the existing date.rs lint), the workspace tests, assets, layers and parity pass.

current_region (Ctrl+A, and the range that sort, filter, AutoSum,
tables and Get Data use when one cell is selected) grew the region one
ring of cells per step and stopped after 10,000 steps, rescanning every
cell of the ring each time. With 20,000 rows of data and one cell
selected, data.sortDescending sorted only the first 10,001 rows and
left the rest as they were; a 100,000-row region took 30 s and was cut
at row 10,001.

It now grows one side at a time while the line next to that side has
data (diagonals included), checking only the cells of that line, with
no step limit.
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit c4e4aeb into storytold:main Oct 10, 2026
@echelon

echelon commented Oct 10, 2026

Copy link
Copy Markdown
Member

Landed — thank you for the contribution! Linear-time current region is a great fix for tall data.

If you haven't already, please come join us on Discord: https://discord.gg/artcraft

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.

3 participants