Skip to content

Commit cbfc4ab

Browse files
robcohenclaude
andauthored
docs: follow up rustledger's new benchmark (Performance page, caption, table) (#35)
* docs: follow up rustledger's new benchmark (Performance page, caption, table) The website side of rustledger/rustledger#3184: - Sidebar: add Reference > Performance. filterSidebar keeps it off the stable channel until a release has the page. - Comparison page: the README's new benchmark caption, the new Validation and Balance Report descriptions, a pointer to the Performance page and memory-chart.svg instead of the retired ledger's memory figures, and the throughput and memory charts. Links to the Performance page come from themeConfig.performancePage, which points stable at the /next/ copy until a release has it. - BenchmarkTable: a Tackler column, Beancount 2 and cached (warm) timings as sub-lines, "n/a" for a missing or zero timing (ledger has no validating command), fallbacks from the Performance page's 10K cells, and entries from before #3182 handled without the new fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(docs): Tackler has no lots or cost basis, so its booking cell is None Tackler's own TEP-1017 defers booking methods "until lots / cost-basis exist in Tackler", and its journal format has only @ / = conversion prices. "Manual" (as for ledger and hledger) implied lot tracking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 049eaf6 commit cbfc4ab

3 files changed

Lines changed: 131 additions & 42 deletions

File tree

‎docs/.vitepress/config.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ export default defineConfig({
137137
// Read by theme/ChannelBanner.vue.
138138
channel: { name: channel, stableVersion, stableHome },
139139

140+
// Read by about/comparison.md. The Performance page came with
141+
// rustledger/rustledger#3184; until a release has it, the stable
142+
// channel links to the /next/ copy rather than a missing page.
143+
performancePage: pageExists('/reference/performance')
144+
? { href: `${base}reference/performance.html`, target: null }
145+
: { href: `${nextHome}reference/performance.html`, target: '_self' },
146+
140147
nav: [
141148
{ text: 'Home', link: '/' },
142149
{ text: 'Documentation', link: '/about/why-rustledger' },
@@ -218,6 +225,7 @@ export default defineConfig({
218225
{ text: 'Plugins', link: '/reference/plugins' },
219226
{ text: 'Error Codes', link: '/reference/errors' },
220227
{ text: 'Options', link: '/reference/options' },
228+
{ text: 'Performance', link: '/reference/performance' },
221229
{ text: 'Architecture', link: '/reference/architecture' },
222230
{ text: 'Compatibility', link: '/reference/compatibility' },
223231
],

‎docs/.vitepress/theme/BenchmarkTable.vue‎

Lines changed: 110 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,62 @@ const VALIDATION_URL =
66
const BALANCE_URL =
77
'https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/balance-history.json';
88
9+
// Field prefixes in the history entries, in column order. `beancount` is
10+
// Beancount 3; Beancount 2 is shown under it in the same column.
11+
const TOOLS = ['rustledger', 'beancount', 'beancount2', 'ledger', 'hledger', 'tackler'];
12+
13+
// Tools with a load cache, for entries that predate `warm_load_cache`.
14+
const DEFAULT_CACHED = ['rustledger', 'beancount'];
15+
16+
// Shown until the fetch returns, or if it fails: the 10K cells of the
17+
// Performance page (rustledger/rustledger#3184, measured 2026-12-01 on
18+
// hledger's 10K journal). Ledger has no validating command, hence null.
919
const validation = ref({
10-
rustledger: '~43ms',
11-
beancount: '~789ms',
12-
ledger: '~108ms',
13-
hledger: '~498ms',
20+
rustledger: { cold: 90, warm: 40 },
21+
beancount: { cold: 1000, warm: 260 },
22+
beancount2: { cold: 920, warm: 250 },
23+
ledger: null,
24+
hledger: { cold: 280, warm: null },
25+
tackler: { cold: 20, warm: null },
1426
});
1527
const balance = ref({
16-
rustledger: '~34ms',
17-
beancount: '~1046ms',
18-
ledger: '~63ms',
19-
hledger: '~538ms',
28+
rustledger: { cold: 110, warm: 50 },
29+
beancount: { cold: 1500, warm: 780 },
30+
beancount2: { cold: 1200, warm: 630 },
31+
ledger: { cold: 580, warm: null },
32+
hledger: { cold: 470, warm: null },
33+
tackler: { cold: 40, warm: null },
2034
});
2135
const loading = ref(true);
2236
37+
/** A positive timing in ms, or null for a missing, zero or non-numeric field. */
38+
function ms(value) {
39+
return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : null;
40+
}
41+
42+
/**
43+
* One history entry as { tool: { cold, warm } | null }. A tool is null when
44+
* the entry has no cold timing for it: entries from before
45+
* rustledger/rustledger#3182 have no Tackler or Beancount 2 fields, and from
46+
* #3182 on the validation series records `ledger_ms: 0`. A warm timing is kept
47+
* only for a tool with a load cache; the others' warm run is just a second run.
48+
*/
49+
function timings(entry) {
50+
const cached = Array.isArray(entry.warm_load_cache) ? entry.warm_load_cache : DEFAULT_CACHED;
51+
const result = {};
52+
for (const tool of TOOLS) {
53+
const cold = ms(entry[`${tool}_ms`]);
54+
const warm = cached.includes(tool) ? ms(entry[`${tool}_warm_ms`]) : null;
55+
result[tool] = cold === null ? null : { cold, warm };
56+
}
57+
return result;
58+
}
59+
60+
function format(value) {
61+
if (value >= 1000) return `~${(value / 1000).toFixed(1)}s`;
62+
return `~${Math.round(value)}ms`;
63+
}
64+
2365
async function fetchBenchmarks() {
2466
try {
2567
const [valRes, balRes] = await Promise.all([fetch(VALIDATION_URL), fetch(BALANCE_URL)]);
@@ -28,24 +70,11 @@ async function fetchBenchmarks() {
2870
const valData = await valRes.json();
2971
const balData = await balRes.json();
3072
31-
if (valData.length > 0) {
32-
const latest = valData[valData.length - 1];
33-
validation.value = {
34-
rustledger: `~${Math.round(latest.rustledger_ms)}ms`,
35-
beancount: `~${Math.round(latest.beancount_ms)}ms`,
36-
ledger: `~${Math.round(latest.ledger_ms)}ms`,
37-
hledger: `~${Math.round(latest.hledger_ms)}ms`,
38-
};
73+
if (Array.isArray(valData) && valData.length > 0) {
74+
validation.value = timings(valData[valData.length - 1]);
3975
}
40-
41-
if (balData.length > 0) {
42-
const latest = balData[balData.length - 1];
43-
balance.value = {
44-
rustledger: `~${Math.round(latest.rustledger_ms)}ms`,
45-
beancount: `~${Math.round(latest.beancount_ms)}ms`,
46-
ledger: `~${Math.round(latest.ledger_ms)}ms`,
47-
hledger: `~${Math.round(latest.hledger_ms)}ms`,
48-
};
76+
if (Array.isArray(balData) && balData.length > 0) {
77+
balance.value = timings(balData[balData.length - 1]);
4978
}
5079
}
5180
} catch (e) {
@@ -58,6 +87,21 @@ async function fetchBenchmarks() {
5887
onMounted(() => {
5988
fetchBenchmarks();
6089
});
90+
91+
const rows = [
92+
{ label: 'Validation (10k txns)', data: validation },
93+
{ label: 'Balance Report', data: balance },
94+
];
95+
96+
// Why a cell has no timing.
97+
const MISSING = {
98+
validation: { ledger: 'ledger has no validating command' },
99+
};
100+
function missingTitle(row, tool) {
101+
return (
102+
(row.data === validation && MISSING.validation[tool]) || 'not measured in the latest run'
103+
);
104+
}
61105
</script>
62106

63107
<template>
@@ -72,6 +116,7 @@ onMounted(() => {
72116
<th>Beancount</th>
73117
<th>Ledger</th>
74118
<th>hledger</th>
119+
<th>Tackler</th>
75120
</tr>
76121
</thead>
77122
<tbody>
@@ -81,62 +126,77 @@ onMounted(() => {
81126
<td>Python</td>
82127
<td>C++</td>
83128
<td>Haskell</td>
129+
<td>Rust</td>
84130
</tr>
85131
<tr>
86132
<td class="feature">Syntax</td>
87133
<td>Beancount</td>
88134
<td>Beancount</td>
89135
<td>Ledger</td>
90136
<td>Ledger</td>
137+
<td>Tackler</td>
91138
</tr>
92139
<tr>
93140
<td class="feature">Validation</td>
94141
<td>Strict</td>
95142
<td>Strict</td>
96143
<td>Optional</td>
97144
<td>Optional</td>
145+
<td>Optional</td>
98146
</tr>
99-
<tr>
100-
<td class="feature">Validation (10k txns)</td>
101-
<td class="highlight">{{ validation.rustledger }}</td>
102-
<td>{{ validation.beancount }}</td>
103-
<td>{{ validation.ledger }}</td>
104-
<td>{{ validation.hledger }}</td>
105-
</tr>
106-
<tr>
107-
<td class="feature">Balance Report</td>
108-
<td class="highlight">{{ balance.rustledger }}</td>
109-
<td>{{ balance.beancount }}</td>
110-
<td>{{ balance.ledger }}</td>
111-
<td>{{ balance.hledger }}</td>
147+
<tr v-for="row in rows" :key="row.label">
148+
<td class="feature">{{ row.label }}</td>
149+
<td
150+
v-for="tool in ['rustledger', 'beancount', 'ledger', 'hledger', 'tackler']"
151+
:key="tool"
152+
:class="{ highlight: tool === 'rustledger' }"
153+
>
154+
<template v-if="row.data.value[tool]">
155+
{{ format(row.data.value[tool].cold) }}
156+
<span v-if="row.data.value[tool].warm" class="sub">
157+
cached {{ format(row.data.value[tool].warm) }}
158+
</span>
159+
</template>
160+
<span v-else class="na" :title="missingTitle(row, tool)">n/a</span>
161+
<span v-if="tool === 'beancount' && row.data.value.beancount2" class="sub">
162+
v2 {{ format(row.data.value.beancount2.cold) }}
163+
<template v-if="row.data.value.beancount2.warm">
164+
/ cached {{ format(row.data.value.beancount2.warm) }}
165+
</template>
166+
</span>
167+
</td>
112168
</tr>
113169
<tr>
114170
<td class="feature">Dependencies</td>
115171
<td>None</td>
116172
<td>Python + pip</td>
117173
<td>None</td>
118174
<td>GHC runtime</td>
175+
<td>None</td>
119176
</tr>
120177
<tr>
121178
<td class="feature">Booking methods</td>
122179
<td>7</td>
123180
<td>7</td>
124181
<td>Manual</td>
125182
<td>Manual</td>
183+
<td title="no lots or cost basis, only @ / = conversion prices">None</td>
126184
</tr>
127185
<tr>
128186
<td class="feature">Plugins</td>
129187
<td>20 + Python</td>
130188
<td>Python</td>
131189
<td>No</td>
132190
<td>No</td>
191+
<td>No</td>
133192
</tr>
134193
<tr>
135194
<td class="feature">WebAssembly</td>
136195
<td>Yes</td>
137196
<td>No</td>
138197
<td>No</td>
139198
<td>No</td>
199+
<td>No</td>
140200
</tr>
141201
</tbody>
142202
</table>
@@ -187,6 +247,18 @@ onMounted(() => {
187247
font-weight: 500;
188248
}
189249
250+
.benchmark-table .sub {
251+
display: block;
252+
font-size: 0.8rem;
253+
color: rgba(255, 255, 255, 0.4);
254+
white-space: nowrap;
255+
}
256+
257+
.benchmark-table .na {
258+
color: rgba(255, 255, 255, 0.35);
259+
cursor: help;
260+
}
261+
190262
.rustledger-name {
191263
color: white;
192264
font-weight: 600;

‎docs/about/comparison.md‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<script setup>
2+
import { useData } from 'vitepress';
3+
4+
// Computed in .vitepress/config.js: stable links to /next/ until a release has the page.
5+
const { theme } = useData();
6+
</script>
7+
18
# How does rustledger compare?
29

310
Plain text accounting tools at a glance.
@@ -9,19 +16,21 @@ Plain text accounting tools at a glance.
916
<div class="benchmark-charts">
1017
<img src="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/validation-chart.svg" alt="Validation Benchmark" class="benchmark-chart" />
1118
<img src="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/balance-chart.svg" alt="Balance Report Benchmark" class="benchmark-chart" />
19+
<img src="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/throughput-chart.svg" alt="Throughput: transactions per second against journal size, one line per tool, flat balance report, first run" class="benchmark-chart" />
20+
<img src="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/memory-chart.svg" alt="Memory: peak resident memory against journal size, one line per tool, flat balance report, first run" class="benchmark-chart" />
1221
</div>
1322

14-
<p class="benchmark-note">Benchmarks run nightly on 10K-transaction ledgers, with <code>main</code> and caches off, so every run parses the whole file. <a href="https://github.com/rustledger/rustledger/actions/workflows/bench.yml">View workflow →</a></p>
23+
<p class="benchmark-note">Benchmarks run nightly, built from <code>main</code>, on hledger's synthetic 10K-transaction journal (the one hledger's own <a href="https://hledger.org/PERFORMANCE.html#other-apps">comparison</a> uses), converted for the beancount-syntax tools. Cold: caches off, every run parses the whole file. Warm: each tool's own load cache on, as in everyday use (ledger, hledger and Tackler have none). Speedups compare against beancount 3 in the same mode. Wall-clock on shared CI runners, so expect about ±15% noise. <a :href="theme.performancePage.href" :target="theme.performancePage.target">Full comparison →</a> <a href="https://github.com/rustledger/rustledger/actions/workflows/bench.yml">View workflow →</a></p>
1524

1625
<details class="benchmark-details">
1726
<summary><strong>Benchmark details</strong></summary>
1827

1928
**What's measured:**
20-
- **Validation**: Parse ledger + validate (balance assertions, account opens, etc.)
21-
- **Balance Report**: Parse + compute all account balances
29+
- **Validation**: Parse ledger + validate (`rledger check`, `bean-check`, `hledger check`, Tackler with no reports; ledger has no validating command)
30+
- **Balance Report**: Parse + compute each account's flat balance
2231

2332
**Memory efficiency:**
24-
rustledger uses about half the memory of Python beancount: 22.7 MB against 51.7 MB peak RSS checking the 10K-transaction ledger in the nightly run.
33+
Peak memory for every tool, at 10K, 100K and 1M transactions, is in the <a :href="theme.performancePage.href" :target="theme.performancePage.target">Performance</a> page's tables (each cell gives the time and the peak memory), and plotted against journal size in the memory chart above (<a href="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/memory-chart.svg"><code>memory-chart.svg</code></a>).
2534

2635
**Run locally:**
2736
```bash

0 commit comments

Comments
 (0)