Repository navigation
ledgermill 0.2.0
Added
- Beancount: arithmetic in a number (
(1 + 2) * 3,10 / 4,-(2 - 5)) in a posting's units, a price, a
cost, abalanceand its tolerance, apricedirective and metadata. The values, places and exponents
are the reference's (28 digits, half to even); an inexact quotient has a tolerance of its own. A division
by zero is adivision-by-zerofinding that leaves out its entry. A malformed expression ((1 + )) is a
parse-errorand, like any parse error, leaves the file with no transactions. A sign in front of a sign and a~
tolerance that is a sum, both without parentheses, are still refused (number-expression).format()
aligns expressions asbean-formatdoes. Seespec/beancount/number-expressions.md. - Beancount:
plugin "beancount.plugins.auto_accounts"is built: every account used and never opened gets anopen
on the day of its first use, so a journal with noopenlines is valid. Every other plugin is still refused
(unsupported-syntax), and the finding now names it indetails.name. An indentedpluginline is
accepted, though the reference rejects it (a gap of every indented directive). See
spec/beancount/auto-accounts.md. - Beancount:
plugin "beancount.plugins.implicit_prices"is built: a price annotation (@,@@) and the
cost of a posting that opens a lot addpriceentries, on the transaction's date and line, soprices(),
value()andholdings()follow them. A price annotation wins over a cost, a cost that reduces a lot
makes no price (withNONEbooking every costed posting opens a lot, so each makes one), equal entries of
one run are dropped, and everypluginline of the root file runs it once more. A configuration string is still refused.
Seespec/beancount/implicit-prices.md. fuzz.ts --beancountwrites arithmetic in numbers now and then.fuzz.ts --beancountand--multiswitchimplicit_pricesandauto_accountson now and then (withauto_accounts, some or allopenlines
dropped) and the summary counts the journals that had each.- Beancount: a posting flag
*straight before the account (*Assets:Bank) is read.
Changed
- The Beancount files of one
loadare one ledger, read in the order given, as the reference reads a file
thatincludes the others: accounts,openandclose, pads, balance assertions, lots and prices apply
across the files. An account opened twice is aduplicate-openfinding on theopenthat comes second when the
entries of all the files are walked by date and then line; a
balance assertion in one file adds up the postings of all. The first file is the root: itsbooking_method
andpluginlines serve all the files, and those of the others do nothing. A refused construct in
any Beancount file makes the whole Beancount ledger refused. The hledger files are still one ledger of their own and
the two merge as before;format()still takes one file. Before, each Beancount file was a ledger of its
own. Seespec/beancount/several-files.md. The harness reads the reference through a root that includes the
files. format()reads the original file once. A Beancount file used to be loaded three times and parsed
once more, an hledger file parsed and then loaded again; a format is now two loads, the original
and the result. On 10,000 transactions, against 0.1.3 from npm on one desktop (median of 7 runs,
alternated): Beancount 287 ms to 179 ms, hledger 154 ms to 104 ms. The formatted text is the same.- hledger: a load copies less. The drafts of a transaction are built once, and a posting's amounts
are moved, not copied, into whatat_cost(),value()andholdings()keep; the lists of a
load get their size up front. A native load of 10,000 transactions takes about 9% less time
(45.6 ms to 41.6 ms); in the wasm the gain is within what the bench can tell apart (46.9 ms to
45.6 ms forloadandtransactions()). - hledger: a number whose mantissa fits in 64 bits is held as a machine integer, a larger one as a big integer
as before (the timings below were measured with a 128-bit integer; see the next entry), so the arithmetic on an ordinary amount needs no big integer and allocates nothing for
it. Against the commit before, on 10,000 transactions: a native load takes 11% less time (39.2 ms to 34.7 ms, median of 7
alternated rounds); in the wasmloadandtransactions()take 7% less (45.2 ms to 42.3 ms,
median of 11 runs) andholdings()12% less (5.41 ms to 4.75 ms); the wasm is 17 KB larger before
compression. Every answer is the same: eight probes with numbers on both sides of the limit
(inspec/hledger/probes/:decimal-across-64-bit, the fourdecimal-*-across-128-bit,decimal-inferred-prices-255,
decimal-many-placesanddecimal-small-around-zero) are compared with hledger. - hledger: a number is 24 bytes in the wasm, not 48. A 128-bit integer is 16-aligned on wasm32 and doubled
the size of every number a ledger keeps, so the wasm memory of a 10,000-transaction load grew by 15 MB
(memory.buffer.byteLength40.2 MB to 55.2 MB). The machine integer is 64 bits now and the big one is
boxed: 42.9 MB on the same ledger, under the 50 MB target. Every answer is the same. - Beancount: a load of several files builds the flat posting list after freeing what reading and
booking held, as it did before the files became one ledger. Built at the peak, the rows raised the wasm
memory of a 10,000-transaction load by 3.2 MB (43.5 MB to 46.7 MB); it is back to 43.5 MB. - hledger: a posting's amount is read once. It was read a second time only to find where it ends,
forformat(); the first read says so unless aDdirective could give the amount a commodity.
Balancing a transaction borrows the commodity names it used to copy. Against the commit before,
on 10,000 transactions: a native load takes 18% less time (36.7 ms to 30.1 ms, median of 9
alternated rounds); in the wasmloadandtransactions()take 13% less (42.0 ms to 36.7 ms,
median of 11 runs) andformat()12% less (103.5 ms to 91.4 ms). Every answer is the same.
Fixed
- Beancount:
holdings()of several files adds the postings in the reference's order, by date and then
line with the file not in the key. It added them by date and then file, so a sum held to 28 significant digits
that rounds at each step could end one digit off when files shared a day. See
spec/beancount/several-files.md.
Release gate
From the release-gate workflow on commit 50041d8 (run 43723414894, 2026-11-15), the head of the
merged memory PR when it ran, CI on that PR's last commit 898b6df (run 43725983534), and the
owner's own runs. The only code change between the two commits adds a drop, with tests and docs.
- Random hledger journals (5,000): 0 mismatches (2,212 that hledger accepts; the rest rejected by
both, 45 skipped, allconversion-postings) - Random Beancount journals (5,000): 0 mismatches (3,709 that bean-check accepts)
- Random price networks (5,000): 0 mismatches
- Random Beancount journals with pairs priced both ways (5,000): 0 mismatches
- Random sets of several ledgers (5,000): 0 mismatches (1,755 sets the reference accepts; 68
skipped, allconversion-postings) - Corpus comparison: 13,723 pass, 0 fail, 52 skip
- Desktop bench against 0.1.3 from npm (CI runner, 10,000 transactions): every operation within
0.48–1.09× of 0.1.3 (the 0.48 is hledgerformat, 185.5 to 89.5 ms; the 1.09 is Beancount
holdings, 7.69 to 8.38 ms); load+transactions 41.2 ms (hledger), 102.6 ms (Beancount); start
14.7 ms - Stress test, 100,000 transactions: ok, no crash (peak wasm memory 637.2 MB hledger, 611.5 MB Beancount)
- Similarity check score: max 0.088 (JPlag against rustledger 0.24.0; fail at 0.15), 0 fail,
8 warn; copydetect max 0.251 (information only) - Real journals: pass (21 pass, 0 fail; two of the owner's hledger journals, each alone and as one set)
- Device targets: not met (Beancount load+transactions on the owner's phone, Android 10 and Chrome
157, on the build of50041d8: worst of 3 is 542.2 ms (runs 436.5, 421.7, 542.2); 0.1.3 from npm
on the same phone, alternated: 446.6, 440.8, 536.7 ms, also above 500 ms). Every other target met:
hledger load+transactions worst 263.9 ms, start 34.3 ms, value 51.5 ms (Beancount, worst),
holdings 39.1 ms (worst), memory 42.9 MB hledger and 43.5 MB Beancount (0.1.3 on the same phone:
48.3 MB and 43.5 MB)