Skip to content

v2.5.0

Choose a tag to compare

@almasumdev almasumdev released this 29 Aug 20:14
· 97 commits to main since this release

Added

  • Async decode and encode on a background isolate.
    Excel.decodeBytesAsync(bytes) and excel.encodeAsync() run the parse and
    the serialize-plus-zip work via Isolate.run, so a Flutter app can open and
    save large workbooks without blocking the UI thread. Results return without
    copying, the calling instance is never mutated, and errors keep their types.
    On the web, where isolates are unavailable, both fall back to the main
    thread so shared code behaves identically. encodeAsync throws a clear
    ExcelEncodeException for workbooks that cannot cross an isolate, such as
    one opened over a live InputFileStream; use encode() there.

Performance

  • Cell writes are about 55x faster, plain-file decode about 18x faster,
    saves about 5x faster, and peak memory is roughly a third lower on large
    workbooks.
    Color lookups now go through a map built once instead of
    rebuilding the full palette on every access; value-only writes share one
    canonical default CellStyle per number format instead of allocating a
    fresh instance per cell (the style is copied privately on first read, so
    editing one cell never affects another); equality and hashing dropped
    derived fields that re-parsed hex strings per comparison; and the writer
    resolves each style once instead of re-fetching it per cell. Writing 100k
    mixed cells went from 5.1 s to 0.09 s, encode from 0.9 s to 0.13 s, and
    decode from 5.7 s to 0.31 s. A 1M-cell build, encode, and decode cycle went
    from about 18 s to 3.8 s, with peak memory down from 1.16 GB to 0.72 GB.
  • Style-heavy files decode about 8x faster and now scale linearly. The
    styles parser re-walked the whole styles tree for every cell format; the
    font list is now materialized once and indexed directly, scoped to the
    <fonts> container so an out-of-range font id can no longer read an
    unrelated element. A 2,500-style workbook that took 12 s to open now opens
    in well under a second.
  • Saving into a heavily styled file no longer linear-scans its records.
    Authored styles resolve against the file's existing fills, gradients, and
    borders through O(1) reverse indexes, with first-occurrence semantics
    preserved.

Fixed

  • A decode and encode round-trip no longer doubles the style records.
    Every parsed cell style was re-appended to styles.xml as a fresh,
    unreferenced record on the first save, roughly doubling a style-heavy
    workbook's styles part per open-and-save cycle. Styles equal to a parsed
    record are now skipped.
  • Editing one cell's style no longer restyles every cell that shares its
    format.
    In a decoded file all cells referencing the same format record
    shared one CellStyle object, so a change through cell.cellStyle silently
    applied to all of them. The getter now returns the cell's own private copy.

Documentation

  • README benchmarks re-measured against excel 4.0.6 with this release's
    performance work: encode 6.5x to 7.5x, decode 3.3x, and create 3x to 3.5x
    faster at 1M and 5M cells. The raw numbers in benchmark/compare/ match.