Skip to content

Benchmarks

There are two benchmark setups with different purposes.

Continuous benchmark — source and results athttps://github.com/ringsaturn/tz-benchmark, visualized athttps://ringsaturn.github.io/tz-benchmark/. It runs in GitHub Actions on each release for cross-package comparison. Runner hardware differs from a developer machine, so absolute numbers differ from local runs while the relative ordering between packages is comparable. The continuous run has covered tzf v2 since 2026-09-11.

Dated snapshots — the directories undersnapshot/ are captured locally on an Apple M3 Max. Everything on this page comes from the2026-11-01 snapshot, measured against the published tzf v2.1.4, tzf-rs 2.1.4 and tzfpy 2.1.2 releases (lite and +full wheels), all on tzf-distv0.0.2026-f.

Methodology

Each finder is initialized once and reused for all queries, matching the documented production pattern. Queries sample two datasets: 170,540 world cities (gt_cities.csv) and 23,408 border-adjacent points (gt_edges.csv), both resolved against full-precision 2026f ground truth. Accuracy also runs a uniform random dataset of 1,000,000 points in Go.

Memory is measured per candidate in an isolated child process. Four columns appear below, and they are not interchangeable:

ColumnMeaning
BaselineRSS before the candidate is constructed
Init peakHigh-water mark (ru_maxrss) reached while loading. A container memory limit has to accommodate this value, or the process is killed at startup even though its steady state would have fit
LiveData the candidate retains once ready to serve queries, from language-native accounting: Go HeapAlloc after a forced GC, Rust a counting global allocator. n/a for Python, whose data lives outside the Python heap
RSS after loadWhat the OS reports for a process ready to serve queries. Closer to Init peak than to Live, because freeing memory does not shrink RSS: the allocator keeps the pages mapped for reuse

Live is the smallest of the three figures for every candidate. RSS after load is at most 0.5 MiB above Init peak.

Query latency

Apple M3 Max, 2026f dataset, 2026-11-01 snapshot.

Go (tzf v2)

Benchmarkns/opp50 (ns)p99 (ns)B/opallocs/op
NewDefaultFinder, world cities350.0208.0150000
NewDefaultFinder, edge cities556.5500.0125000
NewEmbeddedFinder, world cities535.8333.0254200
NewEmbeddedFinder, edge cities12301042275000
NewFullFinder, world cities354.5208.0170800
NewFullFinder, edge cities591.8500.0154200

All three finders query without allocating.

Rust (tzf-rs 2.1.4)

Benchmarkns/iterstddev (ns)
DefaultFinder, random city225.6221.17
DefaultFinder, random edge city489.3310.13
EmbeddedFinder, random city350.34110.85
EmbeddedFinder, random edge city686.948.99

Python (tzfpy 2.1.2)

pytest-benchmark, one get_tz() call per round.

BenchmarkMedian (ns)Mean (ns)OPS (Kops/s)
Random cities, lite666.0745.41,341.6
Random edge cities, lite875.0958.81,042.9
Random cities, +full667.0810.51,233.8
Random edge cities, +full1,208.01,313.5761.4

Per-call overhead is comparable to the Rust figures; the difference reflects the Python-to-Rust call cost through PyO3. The +full rows are the experimental full-precision wheel from tzfpy’s own index, which runs tzf-rs’sEmbeddedFinder over full.tzb.

Accuracy

Wrong-answer rates against full-precision 2026f ground truth. “Offset-eq” counts wrong answers that resolve to the same UTC offset.

DatasetNCandidateWrongWrong %Offset-eq
cities170,540Go NewDefaultFinder (lite .tzm)20.00121
cities170,540Go NewEmbeddedFinder (lite .tzb)20.00121
cities170,540Go NewFullFinder (full .tzb)00.00000
cities170,540Rust DefaultFinder20.00121
cities170,540Rust EmbeddedFinder20.00121
cities170,540tzfpy20.00121
cities170,540tzfpy +full00.00000
edges23,408Go NewDefaultFinder (lite .tzm)10.00431
edges23,408Go NewFullFinder (full .tzb)00.00000
edges23,408Rust DefaultFinder10.00431
edges23,408tzfpy10.00431
edges23,408tzfpy +full00.00000
uniform1,000,000Go NewDefaultFinder (lite .tzm)210.002114
uniform1,000,000Go NewFullFinder (full .tzb)00.00000

The lite and full finders differ only near borders. The simplification bound is 111.2 m; see FAQ for the full displacement table.

Memory

Values in MiB.

Go

CandidateBaselineInit peakLiveRSS after load
Go runtime floor5.15.10.35.4
NewDefaultFinder (lite .tzm)5.544.513.344.6
NewEmbeddedFinder (lite .tzb in place)5.79.60.410.1
NewFullFinder (full .tzb)5.7266.7148.9266.9

Rust

CandidateBaselineInit peakLiveRSS after load
Rust runtime floor5.85.80.05.9
DefaultFinder5.844.523.144.3
EmbeddedFinder5.810.20.210.2

EmbeddedFinder retains 0.2 MiB live: its data is the 'static embedded slice, and the counting allocator sees only the open-time index (chunk skip blocks and per-group latitude stripes) that tzf-rs 2.1 builds.

Python

CandidateBaselineInit peakLiveRSS after load
Python interpreter floor22.522.5n/a22.5
tzfpy (lite)22.561.3n/a61.2
tzfpy +full22.538.8n/a38.8

Observations

  • The in-place mechanism trades query latency for memory. In Go, init peak drops from 44.5 MiB to 9.6 MiB while the world-cities median rises from 208 ns to 333 ns and the edge-cities median from 500 ns to 1,042 ns.
  • Against the 2026-09-14 snapshot (tzf v2.1.1, 2026c), the Go world-cities medians are unchanged at 208, 333 and 208 ns, and the Go edge-cities medians differ by at most 42 ns. The Rust EmbeddedFinder random-city mean rose from 292.68 ns to 350.34 ns, with a standard deviation of 110.85 ns in this run. The Go NewFullFinder init peak fell from 315.5 MiB to 266.7 MiB while its live heap stayed near 148 MiB; the cause of the init-peak change has not been established.
  • The cities dataset grew from 154,694 to 170,540 entries when tz-benchmark refreshed its ground-truth files on 2026-09-20, so the accuracy counts are not directly comparable with the 2026-09-14 tables.
  • The tzfpy +full wheel answers edge cities at a 1,208 ns median against 875 ns for the lite wheel, at 38.8 MiB init peak against 61.3 MiB.
  • The full-precision dataset costs memory rather than latency. Go init peak rises from 44.5 MiB to 266.7 MiB, while the world-cities median stays at 208 ns.
  • Init peak overstates the steady-state cost. Go’s default finder peaks at 44.5 MiB while retaining 13.3 MiB; the full finder peaks at 266.7 MiB while retaining 148.9 MiB. Size a container for the peak and budget long-running cost from the retained figure.
  • Language runtime floors differ (Go 5.1 MiB, Rust 5.8 MiB, Python 22.5 MiB), so cross-language totals are only comparable after subtracting them.
  • The lite dataset disagrees with full-precision ground truth on 2 of 170,540 world cities; the harness counts one of the two as resolving to the same UTC offset.
Last updated on