- commit
- 6ee5e18435a40ddad708908be56452ca694a788c
- parent
- 9471af439d88bfe1f5f990ec1590e858a84452cb
- author
- Dami <dami.etoile@gmail.com>
- kind
- docs risk score 0.0 of 3, Jev's estimate
| M | docs/ | 2 | +- |
| M | docs/ | 29 | ++++++++++++++++++++++------- |
| M | docs/ | 20 | +++++--------------- |
@@ -323,7 +323,7 @@ move without touching callers:
323323 the places functions read ranges.324324 - **Files.** The `.012` reader and writer stream (`fileread.go`,325325 `filescan.go`) and meet the store only through its methods, so another326- encoding would sit beside them; [The .012 format](../files/format.md#reading-and-writing)326+ encoding would sit beside them; [Bounds of support](limits.md#the-012-file)327327 says why there is one.328328 - **Depth limits.** `internal/formula`'s parser caps nesting at329329 `formula.MaxDepth` (1024 levels), so a pathological formula fails to@@ -48,9 +48,8 @@ ten million cells by default): imports keep whole rows up to it, pastes
4848 and fills write at most that many cells at once. WK1 files keep their own4949 8192 x 256. The costs below grow with the cells; the grid itself costs5050 nothing (see [The grid](#the-grid)). A `.012` file is read and written51-as a stream, cells straight into and out of the store ([The .01252-format](../files/format.md#reading-and-writing)), so opening costs about53-the memory the workbook then holds.51+as a stream, so opening costs about the memory the workbook then holds52+([The .012 file](#the-012-file)).5453 5554 | Measure | 8192 x 26 (213 k cells) | 8192 x 256 (2.1 M cells) | 1,000,000 x 10 (10 M cells) |5655 |---|---|---|---|@@ -78,6 +77,22 @@ them out is in [Architecture](architecture.md#the-engine). Reading a
7877 cell's value is an index into its column's block: 2.8 ns7978 (`BenchmarkRead`), 8.6 ns a cell read by a SUM in a full recalculation.8079 80+### The .012 file81+82+The reader and writer stream (`internal/sheet/fileread.go`,83+`filescan.go`): each cell goes into its sheet as its line is read, a84+number typed plainly straight into its 16-byte slot, and the other85+fields are small and decoded whole. Saving writes the cells in86+row-major order as it reads them from the sheet, straight into the87+file.88+89+There is one format. A binary one that stored the slots themselves90+would open ten million numbers in about 0.3 s at best (storing ten91+million slots alone takes 0.17 s) where the JSON takes 1.2 s: a second92+saved on sheets near `max-cells`, and nothing a smaller sheet would93+notice, for the loss of what the JSON gives, diffs, merges, and a file94+anyone can read and fix.95+8196 ## The grid8297 8398 Nothing costs what the grid costs. The cells' occupancy@@ -210,7 +225,9 @@ every cell on screen a shade), at 200 x 60 (`BenchmarkFrame`,
210225 | Typing a number and Enter, through to the frame | 0.89 ms | 2.3 ms (the scale's percentile over 213 k numbers) |211226 212227 Shades and rule colors keep their escape codes, so a plain cell on one213-costs a string concatenation, not a style render.228+costs a string concatenation, not a style render. A custom formula is229+evaluated for each cell drawn, once per recalculation, with its230+references moved for the cell.214231 215232 Wrapped text, borders, row heights and merged cells cost what the216233 screen shows too. A sheet with none of them is drawn a line per row@@ -226,9 +243,7 @@ top (`BenchmarkFrame`, `BenchmarkKeystroke`):
226243 |---|---|---|---|227244 | 8192 x 26 numbers, a frame | 0.18 ms | 0.90 ms | 3.1 ms |228245 | The same laid out, a frame | 0.24 ms | 1.28 ms | 4.3 ms |229-| The same laid out, an arrow key through to its frame | 0.25 ms | 1.25 ms | | A custom formula is230-evaluated for each cell drawn, once per recalculation, with its231-references moved for the cell.246+| The same laid out, an arrow key through to its frame | 0.25 ms | 1.25 ms | |232247 233248 A chart drawn as text costs 4 to 50 us at 24 x 10 to 120 x 40 cells,234249 whatever its data: only the categories that fit are drawn (a pie of 8192@@ -39,26 +39,16 @@ only for their formatting and notes.
3939 4040 ## Reading and writing4141 42-012 reads and writes the file as a stream (`internal/sheet/fileread.go`,43-`filescan.go`). Each cell goes into its sheet as its line is read, a44-number typed plainly straight into the 16-byte slot the sheet keeps it45-in, so opening a file takes about the memory of the workbook, however46-large the file; the other fields are small and decoded whole. Saving47-writes the cells in row-major order as it reads them from the sheet,48-straight into the file. Ten million numbers (236 MB of JSON) open in49-1.2 s and save in 0.5 s ([Bounds of support](../contributing/limits.md#sheet-size)).50-5142 Any JSON with the same fields reads the same: the order of keys,5243 spacing, and the case of field names don't matter. A cell given twice5344 takes its last entry, though an invalid earlier one is refused; the5445 `version` or the `sheets` list given twice around cells is refused.5546 56-There is one format. A binary one that stored the slots themselves57-would open ten million numbers in about 0.3 s at best (storing ten58-million slots alone takes 0.17 s) where the JSON takes 1.2 s: a second59-saved on sheets near `max-cells`, and nothing a smaller sheet would60-notice, for the loss of what the JSON gives, diffs, merges, and a file61-anyone can read and fix.47+012 reads and writes the file as a stream, each cell straight into or48+out of its sheet, so opening a file takes about the memory of the49+workbook however large the file; what that costs, and why there is no50+binary format beside this one, is in51+[Bounds of support](../contributing/limits.md#the-012-file).6252 6353 ## Versions6454