Skip to content
Advanced

Sizes and speeds

The drive's endurance run lasts an hour, and the bench host keeps every run. Before the next campaign the team asks two questions: how much disk a run takes, and whether the host keeps up. This chapter answers both from measured numbers.

In short, the drive's hour takes 110 MiB, and the phase current makes up most of it. The host records the hour far faster than the drive runs it.

Where the numbers come from

Every number on this page comes from a bench in the repository. just bench-book runs them all at release and writes each report as JSON into docs/bench/. just book-figures then draws the charts and tables of this page from those files. A test fails when a chart differs from its report, or when this page's text writes a number no report holds.

A report names the commit and the build it ran, and the machine and the load average before and after each table. Load slows a time, but never changes a size.

The benches ran on build-1, a virtual machine with 14 logical CPUs (AMD EPYC-Genoa Processor, x86_64). Each was a release build at opt-level 3 of commit 838fcb1, built with 4 jobs. The load average ran from 5.30 to 6.77 across the tables.

The drive's hour

The drive's recording holds five tracks, and two of them carry almost every byte. phase_a samples the phase current 25 000 times a second, and can0 takes 1000 frames a second from the CAN bus. just bench-drive records the hour at full scale and sorts every byte of its pieces by the kind of block that holds it.

MiB of the drive's hour (log scale) 0.001 0.01 0.1 1 10 100 series chunks of phase_a, MiB of the hour: 95.002 95.002 events chunks of can0, MiB of the hour: 8.012 8.012 summaries of phase_a, MiB of the hour: 3.146 3.146 records blocks of log, temp and mode, MiB of the hour: 0.773 0.773 puts and copies, MiB of the hour: 0.005 0.005 checkpoints and final indexes, MiB of the hour: 3.000 3.000 piece heads, closes and tails, MiB of the hour: 0.013 0.013 series chunks of phase_a events chunks of can0 summaries of phase_a records blocks of log, temp and mode puts and copies checkpoints and final indexes piece heads, closes and tails MiB of the hour just bench-drive on build-1: sizes don't change with the load.
Where the bytes of the drive's hour go, on a log scale. Series chunks of the phase current hold most of them. Drawn by ww_tape_figures from docs/bench/drive.json.
Part Bytes Of the recording, % Bytes per second of the run
series chunks of phase_a 99 617 283 86.40 27 671
events chunks of can0 8 400 924 7.29 2334
summaries of phase_a 3 299 294 2.86 916
records blocks of log, temp and mode 811 071 0.70 225
puts and copies 5615 0.00 2
checkpoints and final indexes 3 145 936 2.73 874
piece heads, closes and tails 14 085 0.01 4
other blocks 0 0.00 0
zeros between blocks 0 0.00 0
the recording 115 294 208 100.00 32 026

just bench-drive on build-1, load average 6.24 before, 6.24 after.

The series chunks of phase_a take 86 % of the recording, and the events chunks of can0 7.3 %. The summaries of phase_a add 2.9 %, and the checkpoints and final indexes 2.7 %.

Bytes per item

A size grows with the items of the streams that dominate it. The next table gives what one item of each stream costs in its chunks, against the same item stored raw.

Stream Items Items per second Chunk bytes Bytes per item Raw bytes per item
can0 frames 3 600 000 1000 8 400 924 2.334 20.000
phase_a samples 90 000 000 25 000 99 617 283 1.107 2.000

just bench-drive on build-1, load average 6.24 before, 6.24 after.

A sample of phase_a costs 1.1 bytes against its 2 raw bytes. A frame of can0 costs 2.3 bytes against its 20 raw bytes. To predict another recording's size, multiply each stream's rate by its bytes per item. Then add the shares of the summaries and the index that the table above gives for the drive.

How long the hour takes to record

The same bench records the hour into memory, with and without the summaries of phase_a. The example computes every sample and frame as it goes, so this time includes making the signals as well as writing them.

Recording Seconds MB/s of the recording Times faster than the run
with summaries of phase_a 2.84 41 1266
without summaries 3.09 36 1166

just bench-drive on build-1, load average 6.03 before, 6.24 after.

The hour takes 2.8 s with summaries and 3.1 s without them, a difference within one run's noise. The host records the run 1300 times faster than the drive produces it.

Samples: fixed point first

phase_a stores 1.1 bytes a sample because its samples are fixed-point integers. A writer codes an integer column with DELTA, which bit-packs the differences between neighbours per group of 128 samples. A float column has one codec in the format, ALP. It finds floats that began as decimals and stores the integers they came from.

just bench-sample-codecs stores the same quantities both ways and checks that every value comes back bit for bit. It uses three kinds of data: the motor simulation of motor_sim, a recorded speech, and the counts of a 12-bit ADC turned into floats. The format reference describes each data set.

The bench also runs four float codecs the format doesn't have. Gorilla stores each float as the XOR of its bits with the float before it, and Chimp is a refined Gorilla. FLOAT_DELTA and FLOAT_DELTA2 apply DELTA and DELTA2 to the floats' bits in an order that sorts like the numbers.

Ratio to the raw floats (larger: smaller file) 0 4 8 12 16 20 motor_sim f32, fixed point, DELTA: 3.10 3.10 motor_sim f32, ALP: 1.64 1.64 motor_sim f32, best other float codec: 1.99 FLOAT_DELTA2 1.99 FLOAT_DELTA2 motor_sim f64, fixed point, DELTA: 6.20 6.20 motor_sim f64, ALP: 2.51 2.51 motor_sim f64, best other float codec: 2.51 GORILLA 2.51 GORILLA speech f32, 2 ch, fixed point, DELTA: 3.43 3.43 speech f32, 2 ch, ALP: 1.16 1.16 speech f32, 2 ch, best other float codec: 1.23 CHIMP 1.23 CHIMP ADC × 3.3/4096 f32, fixed point, DELTA: 7.31 7.31 ADC × 3.3/4096 f32, ALP: 1.59 1.59 ADC × 3.3/4096 f32, best other float codec: 1.84 FLOAT_DELTA 1.84 FLOAT_DELTA ADC × 3.3/4096 f64, fixed point, DELTA: 14.63 14.63 ADC × 3.3/4096 f64, ALP: 1.32 1.32 ADC × 3.3/4096 f64, best other float codec: 1.57 CHIMP 1.57 CHIMP ADC × 0.1 f32, fixed point, DELTA: 7.31 7.31 ADC × 0.1 f32, ALP: 4.67 4.67 ADC × 0.1 f32, best other float codec: 1.84 FLOAT_DELTA 1.84 FLOAT_DELTA ADC × 0.1 f64, fixed point, DELTA: 14.63 14.63 ADC × 0.1 f64, ALP: 9.02 9.02 ADC × 0.1 f64, best other float codec: 1.59 CHIMP 1.59 CHIMP Decode, ns per value 0 2 4 6 8 10 motor_sim f32, fixed point, DELTA: 0.95 0.95 motor_sim f32, ALP: 1.54 1.54 motor_sim f32, best other float codec: 1.34 FLOAT_DELTA2 1.34 FLOAT_DELTA2 motor_sim f64, fixed point, DELTA: 0.95 0.95 motor_sim f64, ALP: 1.78 1.78 motor_sim f64, best other float codec: 3.77 GORILLA 3.77 GORILLA speech f32, 2 ch, fixed point, DELTA: 0.98 0.98 speech f32, 2 ch, ALP: 1.35 1.35 speech f32, 2 ch, best other float codec: 5.74 CHIMP 5.74 CHIMP ADC × 3.3/4096 f32, fixed point, DELTA: 0.74 0.74 ADC × 3.3/4096 f32, ALP: 1.36 1.36 ADC × 3.3/4096 f32, best other float codec: 1.10 FLOAT_DELTA 1.10 FLOAT_DELTA ADC × 3.3/4096 f64, fixed point, DELTA: 0.78 0.78 ADC × 3.3/4096 f64, ALP: 2.25 2.25 ADC × 3.3/4096 f64, best other float codec: 8.50 CHIMP 8.50 CHIMP ADC × 0.1 f32, fixed point, DELTA: 0.84 0.84 ADC × 0.1 f32, ALP: 1.08 1.08 ADC × 0.1 f32, best other float codec: 1.18 FLOAT_DELTA 1.18 FLOAT_DELTA ADC × 0.1 f64, fixed point, DELTA: 0.77 0.77 ADC × 0.1 f64, ALP: 0.98 0.98 ADC × 0.1 f64, best other float codec: 7.76 CHIMP 7.76 CHIMP motor_sim f32 motor_sim f64 speech f32, 2 ch ADC × 3.3/4096 f32 ADC × 3.3/4096 f64 ADC × 0.1 f32 ADC × 0.1 f64 fixed point, DELTA ALP best other float codec just bench-sample-codecs on build-1, load average 6.77 before, 5.76 after.
The same quantities as fixed point and as floats, per data set: ratio to the raw floats (left, larger is better) and decode time per value (right). The best other float codec is named at its bar, and the load the bench ran at is under the legend. Drawn by ww_tape_figures from docs/bench/sample_codecs.json.

Why fixed point beats floats

Fixed point wins on every set, and by the widest margin where the floats hide integer counts. ADC × 3.3/4096 as f64 reaches a ratio of 15 in fixed point, against 1.6 for the best float codec. ALP can't recover integers from a scale like 3.3/4096, which no short decimal writes.

A fixed-point source hands the writer the integers directly. Store the counts, and put the scale in the track's type.

Which float codec, when

Floats that a device didn't choose still need a codec. ALP is the codec for floats that began as decimals. On ADC × 0.1 it is 2.5 to 5.7 times smaller than the best other float codec.

The XOR codecs win on two sets: by 6 % on speech and by 15 % on ADC × 3.3/4096 as f64. They decode 3.1 to 11 times slower than the bit-packed codecs, since each value waits for the one before it.

A writer could try ALP and FLOAT_DELTA on each chunk and keep the smaller. That pair is the best float codec on four of the seven sets, and within 13 % of the best on the others.

Every codec on every data set

The bench runs in about 18 s. just bench-sample-codecs fetches the speech file into target/bench-data once and checks its hash before it decodes it.

Data Codec Ratio Bits per value Encode ns per value Decode ns per value
motor_sim f32 DELTA of i32, power-of-ten step keeping 24 bits at the peak 3.10 10.32 2.7 0.95
motor_sim f32 GORILLA 1.49 21.46 7.3 3.26
motor_sim f32 CHIMP 1.74 18.36 8.9 4.74
motor_sim f32 FLOAT_DELTA 1.93 16.62 2.8 1.30
motor_sim f32 FLOAT_DELTA2 1.99 16.06 3.3 1.34
motor_sim f32 ALP 1.64 19.46 20.5 1.54
motor_sim f64 DELTA of i32, power-of-ten step keeping 24 bits at the peak 6.20 10.32 2.5 0.95
motor_sim f64 GORILLA 2.51 25.52 8.3 3.77
motor_sim f64 CHIMP 2.50 25.60 15.8 4.56
motor_sim f64 FLOAT_DELTA 1.50 42.61 3.5 2.72
motor_sim f64 FLOAT_DELTA2 1.56 41.08 4.5 2.03
motor_sim f64 ALP 2.51 25.51 27.0 1.78
speech f32, 2 ch DELTA of i16 PCM of the same decode 3.43 9.32 2.8 0.98
speech f32, 2 ch GORILLA 1.02 31.25 7.4 3.00
speech f32, 2 ch CHIMP 1.23 25.97 9.4 5.74
speech f32, 2 ch FLOAT_DELTA 1.10 29.12 2.9 1.29
speech f32, 2 ch FLOAT_DELTA2 1.10 28.98 3.2 1.24
speech f32, 2 ch ALP 1.16 27.63 19.4 1.35
ADC × 3.3/4096 f32 DELTA of i16 ADC counts 7.31 4.38 2.3 0.74
ADC × 3.3/4096 f32 GORILLA 1.51 21.25 6.5 3.19
ADC × 3.3/4096 f32 CHIMP 1.76 18.20 11.3 7.11
ADC × 3.3/4096 f32 FLOAT_DELTA 1.84 17.40 2.7 1.10
ADC × 3.3/4096 f32 FLOAT_DELTA2 1.73 18.51 3.1 1.15
ADC × 3.3/4096 f32 ALP 1.59 20.18 19.4 1.36
ADC × 3.3/4096 f64 DELTA of i16 ADC counts 14.63 4.38 2.5 0.78
ADC × 3.3/4096 f64 GORILLA 1.36 47.10 10.0 4.35
ADC × 3.3/4096 f64 CHIMP 1.57 40.78 15.3 8.50
ADC × 3.3/4096 f64 FLOAT_DELTA 1.37 46.71 3.5 1.99
ADC × 3.3/4096 f64 FLOAT_DELTA2 1.34 47.81 3.9 2.05
ADC × 3.3/4096 f64 ALP 1.32 48.64 30.2 2.25
ADC × 0.1 f32 DELTA of i16 ADC counts 7.31 4.38 2.6 0.84
ADC × 0.1 f32 GORILLA 1.53 20.96 7.4 3.56
ADC × 0.1 f32 CHIMP 1.81 17.70 12.2 7.64
ADC × 0.1 f32 FLOAT_DELTA 1.84 17.43 2.8 1.18
ADC × 0.1 f32 FLOAT_DELTA2 1.73 18.55 3.2 1.20
ADC × 0.1 f32 ALP 4.67 6.85 11.2 1.08
ADC × 0.1 f64 DELTA of i16 ADC counts 14.63 4.38 2.5 0.77
ADC × 0.1 f64 GORILLA 1.38 46.53 9.8 4.33
ADC × 0.1 f64 CHIMP 1.59 40.31 14.7 7.76
ADC × 0.1 f64 FLOAT_DELTA 1.37 46.74 3.1 1.81
ADC × 0.1 f64 FLOAT_DELTA2 1.34 47.84 3.5 1.80
ADC × 0.1 f64 ALP 9.02 7.10 11.7 0.98

just bench-sample-codecs on build-1, load average 6.77 before, 5.76 after.

What event times cost

A frame of can0 costs little because of its start ticks. The writer cuts the starts of an events chunk into time groups of 128 events. Each event keeps only its distance from a line through its group. Periodic data thus costs the bits of its jitter, not of its period.

just bench-event-times codes 10 million events per workload in chunks of 4096 items. It compares the linear groups with three other codecs:

  • raw 64-bit ticks, found by binary search;
  • variable-length integers (varints) of the delta of deltas, the change from one gap to the next, with a skip entry every 128 events;
  • Elias-Fano, which stores the low bits of each tick as they are and the high bits in unary.

One workload reads this machine's own system journal: 5.1 million entries of the last 20 days.

Bytes per event (log scale) 0.001 0.01 0.1 1 10 exact 1 ms period with a few gaps, ww_tape linear groups: 0.014 0.014 exact 1 ms period with a few gaps, delta-of-delta varints: 1.149 1.149 exact 1 ms period with a few gaps, Elias-Fano: 2.789 2.789 exact 1 ms period with a few gaps, raw 64-bit ticks: 8.000 8.000 1 ms period, ±300 ns jitter, ww_tape linear groups: 1.447 1.447 1 ms period, ±300 ns jitter, delta-of-delta varints: 2.035 2.035 1 ms period, ±300 ns jitter, Elias-Fano: 2.789 2.789 1 ms period, ±300 ns jitter, raw 64-bit ticks: 8.000 8.000 bursty traffic, ww_tape linear groups: 3.798 3.798 bursty traffic, delta-of-delta varints: 2.581 2.581 bursty traffic, Elias-Fano: 3.158 3.158 bursty traffic, raw 64-bit ticks: 8.000 8.000 a system journal, 1 µs clock, ww_tape linear groups: 3.021 3.021 a system journal, 1 µs clock, delta-of-delta varints: 2.974 2.974 a system journal, 1 µs clock, Elias-Fano: 2.568 2.568 a system journal, 1 µs clock, raw 64-bit ticks: 8.000 8.000 video frames on their 60 000 Hz clock, ww_tape linear groups: 0.002 0.002 video frames on their 60 000 Hz clock, delta-of-delta varints: 1.149 1.149 video frames on their 60 000 Hz clock, Elias-Fano: 1.545 1.545 video frames on their 60 000 Hz clock, raw 64-bit ticks: 8.000 8.000 video frames on a 1 ns clock, ww_tape linear groups: 0.320 0.320 video frames on a 1 ns clock, delta-of-delta varints: 1.149 1.149 video frames on a 1 ns clock, Elias-Fano: 3.300 3.300 video frames on a 1 ns clock, raw 64-bit ticks: 8.000 8.000 First at or after a tick, ns 0 200 400 600 800 1000 exact 1 ms period with a few gaps, ww_tape linear groups: 19 19 exact 1 ms period with a few gaps, delta-of-delta varints: 266 266 exact 1 ms period with a few gaps, Elias-Fano: 176 176 exact 1 ms period with a few gaps, raw 64-bit ticks: 344 344 1 ms period, ±300 ns jitter, ww_tape linear groups: 216 216 1 ms period, ±300 ns jitter, delta-of-delta varints: 459 459 1 ms period, ±300 ns jitter, Elias-Fano: 196 196 1 ms period, ±300 ns jitter, raw 64-bit ticks: 427 427 bursty traffic, ww_tape linear groups: 405 405 bursty traffic, delta-of-delta varints: 566 566 bursty traffic, Elias-Fano: 347 347 bursty traffic, raw 64-bit ticks: 455 455 a system journal, 1 µs clock, ww_tape linear groups: 238 238 a system journal, 1 µs clock, delta-of-delta varints: 320 320 a system journal, 1 µs clock, Elias-Fano: 172 172 a system journal, 1 µs clock, raw 64-bit ticks: 315 315 video frames on their 60 000 Hz clock, ww_tape linear groups: 11 11 video frames on their 60 000 Hz clock, delta-of-delta varints: 126 126 video frames on their 60 000 Hz clock, Elias-Fano: 78 78 video frames on their 60 000 Hz clock, raw 64-bit ticks: 127 127 video frames on a 1 ns clock, ww_tape linear groups: 66 66 video frames on a 1 ns clock, delta-of-delta varints: 101 101 video frames on a 1 ns clock, Elias-Fano: 59 59 video frames on a 1 ns clock, raw 64-bit ticks: 126 126 exact 1 ms period with a few gaps 1 ms period, ±300 ns jitter bursty traffic a system journal, 1 µs clock video frames on their 60 000 Hz clock video frames on a 1 ns clock ww_tape linear groups delta-of-delta varints Elias-Fano raw 64-bit ticks just bench-event-times on build-1, load average 5.82 before, 5.64 after.
Event start ticks per workload: bytes per event on a log scale (left), and the time to find the first event at or after a tick (right), with the load the bench ran at under the legend. Linear groups are smallest on periodic data. Drawn by ww_tape_figures from docs/bench/event_times.json.

With a 1 ms period and ±300 ns of jitter, an event takes 1.4 bytes. The varints take 2.0 and Elias-Fano 2.8. An exact period takes 0.014 bytes. Bursty traffic is the one generated case where the linear groups lose: 3.8 bytes against 2.6 for the varints.

There, the linear groups pay 1.2 bytes per event for random access. A varint reader walks from its skip entry to the item it fetches, while the linear groups read any item directly. With the linear groups, the first event at or after a tick takes 11 to 400 ns to find. With the varints it takes 100 to 570 ns. Elias-Fano finds a tick faster on four workloads, at a larger size on periodic data.

Every codec on every workload
Workload Codec Bytes per event Coding ns per event Item j ns First at or after a tick ns
exact 1 ms period with a few gaps ww_tape linear groups 0.014 1.0 3.6 18.8
exact 1 ms period with a few gaps raw 64-bit ticks 8.000 0.7 11.3 344.1
exact 1 ms period with a few gaps delta-of-delta varints 1.149 1.2 182.9 266.2
exact 1 ms period with a few gaps Elias-Fano 2.789 6.6 129.6 175.9
1 ms period, ±300 ns jitter ww_tape linear groups 1.447 3.9 68.6 215.9
1 ms period, ±300 ns jitter raw 64-bit ticks 8.000 0.6 10.9 426.8
1 ms period, ±300 ns jitter delta-of-delta varints 2.035 2.8 274.7 459.2
1 ms period, ±300 ns jitter Elias-Fano 2.789 6.4 157.6 196.3
bursty traffic ww_tape linear groups 3.798 4.5 68.9 404.5
bursty traffic raw 64-bit ticks 8.000 0.6 10.9 455.0
bursty traffic delta-of-delta varints 2.581 5.6 491.5 566.3
bursty traffic Elias-Fano 3.158 7.2 177.4 346.8
a system journal, 1 µs clock ww_tape linear groups 3.021 4.6 59.5 237.6
a system journal, 1 µs clock raw 64-bit ticks 8.000 0.7 9.4 315.4
a system journal, 1 µs clock delta-of-delta varints 2.974 3.5 281.2 319.7
a system journal, 1 µs clock Elias-Fano 2.568 9.9 93.5 172.2
video frames on their 60 000 Hz clock ww_tape linear groups 0.002 0.9 2.7 10.7
video frames on their 60 000 Hz clock raw 64-bit ticks 8.000 0.6 6.7 126.8
video frames on their 60 000 Hz clock delta-of-delta varints 1.149 1.2 73.9 125.9
video frames on their 60 000 Hz clock Elias-Fano 1.545 5.6 47.5 77.9
video frames on a 1 ns clock ww_tape linear groups 0.320 4.0 11.3 65.8
video frames on a 1 ns clock raw 64-bit ticks 8.000 0.6 6.8 125.7
video frames on a 1 ns clock delta-of-delta varints 1.149 1.2 69.9 101.1
video frames on a 1 ns clock Elias-Fano 3.300 6.1 38.7 59.4

just bench-event-times on build-1, load average 5.82 before, 5.64 after.

A clock that matches its source

A clock that matches its source saves the most. Take 1 million video frames at 60000/1001 frames a second. On the stream's own 60 000 Hz clock every frame lies on the period, and a frame takes 0.002 bytes. On a 1 ns clock the same frames take 0.32 bytes, since rounding leaves a residual of 0 or 1 ns per frame.

Ends beside the starts

Spans need an end per event as well as a start. Spans back to back end where the next one starts, so their ends cost nothing beyond the starts. Spans with gaps between them store a duration per event.

Workload Raw starts and ends bytes per event Starts bytes per event Starts and ends bytes per event
spans back to back 16.000 2.938 2.938
spans with gaps 16.000 3.333 5.935

just bench-event-times on build-1, load average 5.64 before, 5.64 after.

How fast summaries keep up

The writer builds the summaries of phase_a as the samples arrive, so the summaries must keep up with ingest. SeriesSummaries::push keeps every statistic of a summary node in one pass, through vector kernels with exact integer sums. just bench-summaries measures that pass on noise of each element type, alone and with the RAW codec beside it.

Element Channels RAW MB/s Summaries MB/s RAW and summaries MB/s
I8 1 89 067 2569 2510
U8 1 102 169 2605 2440
I16 1 63 765 4802 4555
I16 4 73 267 3620 3516
U16 1 71 746 4794 4219
I32 1 67 922 7086 6326
U32 1 68 821 7078 6197
I64 1 70 673 4884 4407
U64 1 68 226 4842 4413
F32 1 61 082 2020 2203
F64 1 67 310 4757 4203
ComplexI16 1 66 352 5263 4876
ComplexI16 4 65 898 4087 4071
ComplexF32 1 71 290 2519 2456

just bench-summaries on build-1, load average 5.75 before, 5.33 after.

The single pass matters more than the vector code. The next table compares the kernels with a summariser that keeps one statistic at a time, one pass each, on nodes of 1024 frames.

Element One at a time MB/s Portable kernel MB/s AVX2 kernel MB/s AVX-512 kernel MB/s
I16 1506 4077 8390 11 830
ComplexI16 905 2684 6414 10 448
I32 3283 4431 12 204 13 321

just bench-summaries on build-1, load average 5.33 before, 5.30 after.

On i16 the AVX2 kernel reaches 8400 MB/s, against 1500 MB/s one statistic at a time. The portable kernel reaches 4100 MB/s.

What the writer spends

The writer's own cost per chunk is a copy, the CRCs and the content hash. just bench-chunks measures each part on a series chunk of 1 MiB, which holds 524 288 i16 samples.

µs per 1 MiB series chunk 0 200 400 600 800 1000 chunk::write_chunk: copy and CRCs, µs per 1 MiB chunk: 58 58 Block::read: the CRCs checked, µs per 1 MiB chunk: 37 37 ItemHash::of: BLAKE3, µs per 1 MiB chunk: 235 235 TrackHash::chunk_unit: the unit hash, µs per 1 MiB chunk: 0.159 0.159 TapeWriter::write_chunk (columns), µs per 1 MiB chunk: 307 307 TapeWriter::write_chunk into a MemSink, µs per 1 MiB chunk: 958 958 chunk::write_chunk + TapeWriter::write_block, µs per 1 MiB chunk: 327 327 chunk::write_chunk: copy and CRCs Block::read: the CRCs checked ItemHash::of: BLAKE3 TrackHash::chunk_unit: the unit hash TapeWriter::write_chunk (columns) TapeWriter::write_chunk into a MemSink chunk::write_chunk + TapeWriter::write_block µs per 1 MiB chunk just bench-chunks on build-1, load average 5.68 before, 5.68 after.
What a 1 MiB series chunk costs the writer, µs per chunk, with the load the bench ran at under the legend. The content hash takes most of TapeWriter::write_chunk. Drawn by ww_tape_figures from docs/bench/chunks.json.
What ns per chunk GB/s
chunk::write_chunk: copy and CRCs 57 629 18.20
Block::read: the CRCs checked 36 665 28.60
ItemHash::of: BLAKE3 235 403 4.46
TrackHash::chunk_unit: the unit hash 159 6598.18
TapeWriter::write_chunk (columns) 306 780 3.42
TapeWriter::write_chunk into a MemSink 957 762 1.10
chunk::write_chunk + TapeWriter::write_block 327 055 3.21

just bench-chunks on build-1, load average 5.68 before, 5.68 after.

TapeWriter::write_chunk takes about 310 µs per chunk, and the hash takes 240 µs of that. Besides the hash, the writer spends 71 µs per MiB. The copy with its CRCs takes 58 µs, and a reader checks the CRCs of the whole block in 37 µs. A writer into a growing memory sink spends more, since the sink copies its bytes each time it grows.

Reading a track's timeline

A reader finds where a series track's samples lie from its chunk heads alone. A head read stops before the samples, so its cost hardly grows with the chunk. just bench-chunks reads the timeline of 256 chunks of 1 MiB from memory, in a file without alignment and in one aligned to 4 KiB.

Read Bytes read per chunk ns per chunk
TapeReader::series_timeline: heads alone 335 538
TapeReader::read_block of every chunk 1 048 895 74 309
TapeReader::range_hash: unit hashes from the index 120 160

just bench-chunks on build-1, load average 5.68 before, 5.68 after.

Read Bytes read per chunk ns per chunk
TapeReader::series_timeline: heads alone 4084 1951
TapeReader::read_block of every chunk 1 052 644 76 400
TapeReader::range_hash: unit hashes from the index 120 159

just bench-chunks on build-1, load average 5.68 before, 5.68 after.

A head reads 335 bytes, or 4084 bytes in an aligned file, where the head reaches to the next 4 KiB boundary. A whole block reads 1 048 895 bytes and checks its CRCs.

What the writer holds in memory

The writer keeps the index of the open piece in memory, so its heap grows with the blocks of the piece. just bench-memory counts that heap over a piece of 256 MiB, on a sink that keeps no bytes.

Blocks Tracks Blocks in the piece New writer (bytes) Peak before the close (bytes) Peak with the close (bytes) Before the close, per block (bytes)
records, 4 KiB 1 64 002 0 13 652 824 44 221 584 213.3
records, 4 KiB 10 63 997 0 13 654 088 44 220 808 213.4
records, 4 KiB 100 63 952 0 13 709 248 44 257 608 214.4
records, 4 KiB 1000 63 485 0 27 575 528 62 390 632 434.4
records, 4 KiB 10 000 60 609 0 32 442 143 66 086 344 535.3
series chunks, 1024 KiB 1 256 0 3 166 431 3 166 431 12368.9

just bench-memory on build-1, load average 6.49 before, 6.49 after.

With records blocks of 4 KiB on one track, the heap peaks at about 14 MB before the close and 44 MB with it.

What definitions and puts cost

The writer puts a definition only near the data that needs it, so a new track costs its own record. just bench-tracks adds 10 000 tracks one by one, each with a records block, and then reads the piece back.

What s
add 1000 tracks 0.007
add 5000 tracks 0.040
add 10000 tracks 0.085
close the piece 0.015
open it and read the definitions 0.023

just bench-tracks on build-1, load average 6.03 before, 6.03 after.

Puts and state copies cost space in proportion to the tracks in use, not to the tracks defined. The bench writes a 256 MiB piece with 10 000 tracks defined and 4 KiB records blocks on the tracks in use, in turn. It keeps the writer's default policies: a near of 32 MiB, and a copy 1 MiB after the newest record.

Tracks in use Put and copied bytes Of the piece, %
10000 7 005 520 2.610
100 103 725 0.039

just bench-tracks on build-1, load average 6.03 before, 6.03 after.

A put that finds its item near costs almost nothing. The bench writes a definition 60 KiB long again and again, each time within its near. The writer hashes nothing again: it compares the hash it computed once, when the application defined the item.

What Bytes per block
hashed 0.0
copied 6.2

just bench-tracks on build-1, load average 6.03 before, 6.03 after.

How fast a radio capture records

The RF capture of Series takes 20 million complex samples a second. just bench-rf-core records a minute of it on one core with each codec. The bench makes each chunk's samples before the chunk and doesn't time them.

Codec Bytes per sample Codec ms/s write_chunk ms/s Summaries ms/s Writer MS/s Writer MB/s
RAW 4.055 3.5 26.3 19.4 404 1615
PACKED12_LSB 3.055 67.9 21.7 20.6 181 725
DELTA 2.899 117.4 20.2 20.2 126 506

just bench-rf-core on build-1, load average 6.45 before, 6.00 after.

PACKED12_LSB stores a sample in 3.1 bytes, against 4.1 bytes with RAW. DELTA saves little more, since the noise of the band leaves the differences of neighbours nearly as wide as the samples. The codec takes the largest share of the writer's time, more than write_chunk with its CRCs and its hash.

The same bench then reads 10 s of the capture back from memory. It checks every chunk and decodes it.

Codec Reader MS/s Reader MB/s
RAW 1358 5431
PACKED12_LSB 976 3906
DELTA 368 1472

just bench-rf-core on build-1, load average 6.00 before, 6.15 after.

Recording the capture to disk

just bench-rf-chain records the same capture into a chain of piece files, a piece per minute. Eight worker threads code the chunks with PACKED12_LSB, and one thread writes them. The bench then opens every piece and reads one second back.

What Value Unit
Capture recorded 878.7 s
Wall time 924.1 s
Sustained 19.0 MS/s
Samples in 76 MB/s
Written 50.00 GiB
Write rate 58 MB/s
Writer thread busy 100 %
Pieces 15
Smallest piece 2.37 GB
Largest piece 3.67 GB
Bytes per sample 3.055

just bench-rf-chain on build-1, load average 6.30 before, 6.01 after.

Read ms Bytes read Reads
Open 15 pieces 525.6 47 020 105
Second 439: 20000000 samples decoded 112.2 65 424 804 103

just bench-rf-chain on build-1, load average 6.01 before, 6.01 after.

The writer thread is busy the whole run and sustains 19 million samples a second, just short of the capture.

Running the measurements again

One recipe reruns every number on this page:

just jobs=4 bench-book   # every bench at release, into docs/bench/*.json
just book-figures        # the charts and tables of this page, from those files

Each bench runs on one core, except the RF chain with its worker threads. bench-book refuses a tree with changes, since a report names its commit. The RF chain needs as many GiB of free disk as rf_gib names, in rf_dir under target/ by default.

Run the recipe on a quiet machine, and compare the load average under each table with your own run. --help lists each bench's settings.

After a rerun, cargo nextest run -p ww_tape_figures names each number of this page that changed. The page Numbers points the anchors of an older index of numbers here.