mirror of
https://github.com/storytold/wordcraft.git
synced 2026-10-30 13:27:27 -06:00
Native JSON wrote Document::media and Document::passthrough with serde's default for bytes, an array of numbers. With a synthetic 27 MiB picture a recovery copy (compact) was 96.4 MiB and a .json file (pretty-printed, one number per line) 285.5 MiB. Each part is now one standard base64 string (doc::byte_store, using the workspace base64 crate), encoded straight into the writer. Reading accepts base64 or the old array of numbers, so recovery copies and .json files written before still open; anything else is an error, never a panic. Measured (release, same synthetic picture): compact 96.4 -> 36.0 MiB, pretty 285.5 -> 36.1 MiB, write 252/614 -> 52/57 ms, read 404/533 -> 46/37 ms. A recovery snapshot of a 6,000-paragraph document with the picture: 99 -> 39 MB, worker time 2.3 -> 0.26 s, start-up scan 1.03 -> 0.14 s. Tests: byte_store unit tests (round trip, old arrays, hostile values); recovery_format.rs native_json_stores_bytes_as_base64, native_json_with_byte_arrays_still_opens, native_json_with_bad_bytes_is_an_error, ignored measurement native_json_size_with_a_large_picture; desktop.rs copies_with_byte_arrays_written_before_still_restore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
568 B
TOML
21 lines
568 B
TOML
[package]
|
|
name = "wordcraft-doc"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
description = "WordCraft document model: stories, paragraphs, runs, tables, sections, styles, numbering, fields, notes, comments, revisions; edit primitives"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
wordcraft-geom = { workspace = true }
|
|
base64 = { workspace = true }
|
|
serde = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
unicode-segmentation = { workspace = true }
|
|
|
|
[dev-dependencies]
|
|
proptest = { workspace = true }
|