Skip to content

perf: optimise <v> cell value parsing#622

Open
alexander-beedie wants to merge 1 commit intotafia:masterfrom
alexander-beedie:perf-read-value
Open

perf: optimise <v> cell value parsing#622
alexander-beedie wants to merge 1 commit intotafia:masterfrom
alexander-beedie:perf-read-value

Conversation

@alexander-beedie
Copy link
Contributor

@alexander-beedie alexander-beedie commented Mar 8, 2026

Builds on #611 (optimising xlsx cell value reads) for a further ~8-10% performance gain for typical reads.

Optimisation

When reading "n", "s", "b", and "e" values with read_value, these types are guaranteed to be plain ASCII so we can bypass the xml10_content and UTF8/String overhead and deal directly with them as raw bytes. (Other types fall-through to the usual path, with the necessary additional handling).

  • s: integer index (into shared string table)
  • n: numeric literal
  • b: boolean
  • e: error

Performance

Note: these tests are on mixed-type data; if you have a workbook with nothing but strings that aren't in the shared string table, you won't see the same gains. These timings should be fairly representative of real world data though.

The gain here is additive with #621 (the code being updated is entirely disjoint), so when combined we're looking at about another ~25% speedup1 over the latest release for typical workbooks.

┌──────────────────┬──────────────┬─────────────┬─────────────┬─────────┐
│ file             │        cells │ master (ms)branch (ms) │ speedup │
├──────────────────┼──────────────┼─────────────┼─────────────┼─────────┤
│ test_1000000_100 │  100,000,00022,05519,9139.7% │
├──────────────────┼──────────────┼─────────────┼─────────────┼─────────┤
│ test_100000_100  │   10,000,0002,2001,9839.9% │
├──────────────────┼──────────────┼─────────────┼─────────────┼─────────┤
│ test_10000_100   │    1,000,000215.6197.78.3% │
├──────────────────┼──────────────┼─────────────┼─────────────┼─────────┤
│ test_10000_10    │      100,00022.420.39.5% │
├──────────────────┼──────────────┼─────────────┼─────────────┼─────────┤
│ test_1000_10     │       10,0002.302.089.7% │
└──────────────────┴──────────────┴─────────────┴─────────────┴─────────┘

Footnotes

  1. Benchmarked on: Apple Silicon M3 Max

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