bench: baseline DecodeRawAnalogFrame (AnalogInData) - #787
Conversation
Supported firmware fills AnalogInData. The decode baseline and the framing/consumer buffers were still timing AnalogInDataFloat. Co-authored-by: Tyler Kron <tylerkron@gmail.com>
Code Review by Qodo
1.
|
PR Summary by QodoBenchmark raw analog decoding as the supported firmware hot path
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
DecodeCombinedFrame still built its frames from AnalogInDataFloat, so the combined case timed a payload no supported firmware sends (Qodo). It now carries raw counts plus DIO, like a real stream with DIO enabled. ProtobufFramingBenchmarks sized its buffer as "a 4 KB read" at 50 frames, which held for ~71-byte float frames. A 16-channel raw-count frame is ~40 bytes, so 50 frames is ~2 KB; FrameCount is now 100 (3,959 bytes). README: the baseline intro said "non-protobuf rows" (the framing rows are protobuf too) and that untouched rows "refresh on the next workflow_dispatch". Nothing writes the README, and the workflow runs on ubuntu-latest, whose numbers do not compare with the M3 Pro table. Say which rows describe float payloads, and keep the 2a59fd1 before figures the 800x comparison relies on now that the before/after table is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 67a5738 |
…ed on Qodo read "the framing and consumer buffers carry raw counts" and "those rows describe float payloads" as a contradiction. Both are true: the code now sends raw counts, and the published numbers predate that change. A small table now separates the two for each row, and each affected timing table's heading says it was measured on float frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 6dad3d2 |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 6dad3d2 |
|
Qodo-clean, CI green — ready for review |
What was wrong
Supported firmware streams raw ADC counts (
AnalogInData). The benchmark harness still timedAnalogInDataFloatas the hot path:DecodeAnalogFloatFramewas the BenchmarkDotNet baseline, and its summary said the firmware's fast streaming encoder sends calibrated floats. It doesn't: the fast encoder (Nanopb_EncodeStreamingFastin daqifi-nyquist-firmware) writes analog values only as field 2,analog_in_data(packed sint32), and the nanopb path zeroesanalog_in_data_float_count.DecodeCombinedFrameandSyntheticFrames, which feedsProtobufFramingBenchmarksandStreamConsumerBenchmarks, built float frames too. So those benchmarks timed a payload no supported firmware sends.2a59fd1baseline still showed the pre-perf(sdcard): stop the protobuf log parser decoding a whole 64 KB buffer before its first sample #699 first-sample outlier, and a second table showed perf(sdcard): stop the protobuf log parser decoding a whole 64 KB buffer before its first sample #699's after numbers for the same methods.How it was fixed
DecodeRawAnalogFrameis[Benchmark(Baseline = true)].DecodeAnalogFloatFramestays as the defensive protocol branch: the decoder still accepts pre-scaled floats, but no supported firmware fills that field.DecodeCombinedFramecarries raw counts plus DIO.AnalogInDataraw counts (1_000 + channel), the same shapeSdCardParseBenchmarksalready uses.ProtobufFramingBenchmarks.FrameCountgoes from 50 to 100 (3,959 bytes). The buffer still models one 4 KB read, which isStreamMessageConsumer's default buffer.ProtobufTimeToFirstSample9.4 µs / 263 KB,ProtobufDrainAll2,091.4 µs / 13,170 KB), labelled as copied from perf(sdcard): stop the protobuf log parser decoding a whole 64 KB buffer before its first sample #699 and not re-measured. A small table lists each row's current payload next to the payload its published number was measured on.DecodeCombinedFrame, framing and consumer were measured on floats and have not been re-measured. It also says nothing refreshes the table: the Benchmarks workflow runs onubuntu-latestand only posts to its run summary. The 2a59fd1 before figures behind the "800× CSV" comparison are kept in the text.SdCardParseBenchmarksis untouched. No production code, CI, or tests.Verification
dotnet build Daqifi.Core.sln -c Release: 0 warnings.--job dryrun ofStreamDecodeBenchmarks,ProtobufFramingBenchmarksandStreamConsumerBenchmarks: all 6 cases run, andDecodeRawAnalogFramereports Ratio 1.00. That was a smoke test only. The suite was not re-measured, and the README says so.🤖 Generated with Claude Code