Formualizer Docs
Guides

Large Workbook Performance

Practical options for loading and recalculating larger XLSX, JSON, and generated workbooks.

Formualizer's default path uses the stable dependency graph and is appropriate for most applications. Large workbooks benefit most from choosing the right load backend, batching writes, and evaluating only the cells your workflow needs.

Choose the right XLSX backend

Use the native XLSX reader for loading and cache-only recalculation. In Python, fz.Workbook.from_path("model.xlsx") uses it by default. The calamine backend name is a compatibility alias. Use umya when you need the rich read/write backend.

Use sparse-friendly imports

Large spreadsheets often have far-apart populated cells, full-column formulas, or formatting over a much larger grid than the logical model. Formualizer applies load limits and sparse ingest paths to avoid treating formatting-only grid extent as real model size.

If a workbook fails a load budget, inspect whether it contains:

  • a small populated model with very large worksheet dimensions
  • whole-column formulas over sparse inputs
  • formatting or metadata that expands worksheet bounds
  • accidental far-row/far-column cells

Batch writes before recalculation

InputRust / PythonJS/WASM
A row-major grid or ragged rowsset_valuessetValues
Equal-length typed columns, including Arrow dataset_columnssetColumns
Scattered changes that should leave nearby cells aloneset_cellssetCells

Keep data in the producer’s layout. In the 5M-cell run below, importing columns directly took 28.3 ms. Recalculate after writing all inputs. For imports that do not need undo, the default workbook already has recording disabled.

See Workbook Edits and Batching.

Evaluate targeted outputs first

If your application only needs a few output cells, prefer targeted evaluation before full-workbook recomputation:

let outputs = wb.evaluate_cells(&[("Summary", 10, 2), ("Summary", 11, 2)])?;

Targeted evaluation is often enough for API-style spreadsheet workflows.

Keep an interactive host responsive

Rust hosts can spread recalculation over calls, retain a schedule, and prioritize a visible viewport. See Interruptible Recalculation for soft budgets, progress, cancellation and pending values. Graph and schedule builds and individual family runs remain atomic.

Limit a tenant’s evaluation

  • Set deadline.max_elapsed for an elapsed-time budget. Long lookups, criteria functions and range traversals now poll inside the function. A deadline or cancellation fails the request at a checkpoint, even when the formula wraps the work in IFERROR. A spill commit that has begun completes atomically, so allow for cooperative stop latency.
  • Set work.max_work_units for a work budget. An array-lifted lookup charges the table size per lookup value. Array-lifted criteria charge the scanned range per element. This supplements the existing vertex accounting. A stopped request reports the reason (Deadline, WorkUnits, or cancellation) and keeps unfinished results out of the workbook.
  • Set scratch.materialized_array_cells to bound intermediate arrays and copied LET range bindings. Arrays wider than a worksheet incur a higher per-column charge. An over-budget result gives #NUM!. A LET expression can still ignore an over-budget binding or use its range dimensions by reference. This limit measures array work in cells and does not cap process RSS.
  • Set scratch.materialized_array_text_bytes to bound the text one intermediate array may hold while an operator or a function builds it (256 MiB by default). A cell can hold 32,767 characters, so the cell budget alone does not bound memory: =REPT("x",32767)&SEQUENCE(1000,1000) is a million cells and 32 GiB of text. An over-budget array gives #NUM!, before anything is allocated when one value is repeated across it. The budget is per array, not a cap on the whole evaluation.

Copied-formula families

Copied formulas that share a shape (a column of =B2*C2, =B3*C3, ...) are evaluated together as one family over Arrow columns. This is the default and needs no configuration.

FormulaPlane span evaluation, the opt-in accelerator in earlier releases, was removed in 0.10.0. WorkbookConfig::with_span_evaluation, FormulaPlaneMode and the Python/WASM span_evaluation toggles are still accepted but ignored, and the default engine is faster than span mode was. Remove them when convenient.

Release measurements

Release build, Rust Workbook API, changelog off, best of three on one 24-core Linux host. Benchmark record and revision.

Bulk writes

WorkloadResult
Overwrite 10,000 formulas with valuesset_values 7.78 ms, set_value loop 59.1 ms (8×)
Date-formatted column, 100,000 rowsFirst date write 0.08 ms, dates over dates 0.07 ms, numbers over dates 0.09 ms. The last write cleared the format and read back as plain numbers.
Fresh sheet, 1,000,000 rows × 5 columns (5M cells)set_columns 28.3 ms (6 ns/cell), set_values 93.9 ms (19 ns/cell). Peak RSS for the whole run was 287 MB.
Overwrite 100,000 rows of Data!A with 200 cross-sheet readers of =SUM(Data!A:A)Bulk write 0.22 ms, recalculation 1.92 ms. All readers returned the correct result.
XLSX with one 100,000-row shared formula and deferred graph buildingLoad 132 ms, two bulk writes totaling 150,000 cells (half over shared-formula cells) 0.56 ms, evaluate_all 81.7 ms. Overwritten cells held values and surviving formulas read the new inputs.

Row-at-a-time writes

Row-major set_value loop on a fresh sheet without preallocation.

Rows × columnsBeforeAfter
1,000 × 1046.2 ms26.8 ms
4,000 × 10410 ms98.9 ms
16,000 × 105,625 ms405 ms
32,768 × 1023,095 ms865 ms
65,536 × 1045,896 ms1,663 ms
100,000 × 426,560 ms994 ms

Evaluation limits

One formula on an empty sheet with a 2 s deadline.

OperationBeforeAfter
SUMIF with array criteria12.6 sDeadline at 2.00 s
MATCH with array lookup values20.2 sDeadline at 2.00 s
DDB with a long depreciation schedule3.2 sUnder 1 ms
FREQUENCY with large data and bin arraysOver 60 s0.39 s
TRANSPOSE producing a wide intermediate arrayAborted over 4 GB#NUM! at 41 MB
LET with an unused range bindingAborted over 8 GB0 at 10 MB

On this page