Dart FFI library writes million-row Excel files with flat 191 MB memory usage

A Dart developer built an FFI wrapper called xlsxwriter around the C library libxlsxwriter after a production container crashed when a customer exported 400,000 rows to an .xlsx file. Popular Dart Excel packages like excel and excel_community use in-memory object models, with peak memory reaching 614 MB and 1,778 MB respectively for 100,000 rows. The new library's constant-memory mode flushes each row to a temporary file on disk immediately after writing, keeping RAM usage flat at around 191 MB regardless of row count — even at one million rows. In contrast, the library's default in-memory mode climbs to over 1,400 MB at one million rows, highlighting the trade-off between flexibility and memory efficiency. The constant-memory mode requires rows to be written strictly top-to-bottom and supports features like date formatting, image embedding, and conditional formatting via the underlying C library.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in