From 29e665a7e06dbdb1a245f5a5edad6703ef1e1f83 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 31 Jul 2026 22:51:52 -0400 Subject: [PATCH] test(benchmark): baseline the general-purpose codecs on 128-char input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hexDecode128/hexEncode128 have no denominator in the suite — decode64 can be read against hexDecodeOurs, but the 64-byte cases had nothing to compare to. Adds Hex.decode(hex128) and Hex.encode(bytes64) so the size-enforcing pair's advantage is readable straight off the results. Co-Authored-By: Claude Opus 5 (1M context) --- .../quartz/benchmark/HexBenchmark.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/HexBenchmark.kt b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/HexBenchmark.kt index 3b11aa84df..118ebb1f6d 100644 --- a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/HexBenchmark.kt +++ b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/HexBenchmark.kt @@ -133,6 +133,24 @@ class HexBenchmark { r.measureRepeated { Hex.encode128(bytes64) } } + /** The general-purpose decoder on the same 128 chars, for comparison with [hexDecode128]. */ + @Test + fun hexDecodeOurs128() { + r.measureRepeated { + Hex + .decode(hex128) + } + } + + /** The general-purpose encoder on the same 64 bytes, for comparison with [hexEncode128]. */ + @Test + fun hexEncodeOurs128() { + r.measureRepeated { + Hex + .encode(bytes64) + } + } + /** The pre-existing two-pass way to safely decode an id, for comparison with [hexDecode64OrNull]. */ @Test fun hexIsHex64ThenDecode() {