-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbench.zig
More file actions
585 lines (504 loc) · 20.7 KB
/
Copy pathbench.zig
File metadata and controls
585 lines (504 loc) · 20.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
const std = @import("std");
const eth = @import("eth");
// ============================================================================
// Benchmark harness
// ============================================================================
const BenchResult = struct {
name: []const u8,
iterations: u64,
total_ns: u64,
fn nsPerOp(self: BenchResult) u64 {
if (self.total_ns == 0) return 0;
return self.total_ns / self.iterations;
}
fn opsPerSec(self: BenchResult) u64 {
if (self.total_ns == 0) return 0;
return self.iterations * 1_000_000_000 / self.total_ns;
}
};
fn bench(name: []const u8, warmup: u32, iterations: u32, comptime func: fn () void) BenchResult {
for (0..warmup) |_| {
func();
}
var timer = std.time.Timer.start() catch @panic("timer unavailable");
for (0..iterations) |_| {
func();
}
const elapsed = timer.read();
return .{
.name = name,
.iterations = iterations,
.total_ns = elapsed,
};
}
fn benchAlloc(name: []const u8, warmup: u32, iterations: u32, allocator: std.mem.Allocator, comptime func: fn (std.mem.Allocator) void) BenchResult {
for (0..warmup) |_| {
func(allocator);
}
var timer = std.time.Timer.start() catch @panic("timer unavailable");
for (0..iterations) |_| {
func(allocator);
}
const elapsed = timer.read();
return .{
.name = name,
.iterations = iterations,
.total_ns = elapsed,
};
}
fn printResults(results: []const BenchResult) void {
var buf: [16384]u8 = undefined;
var writer_impl = std.fs.File.stdout().writer(&buf);
const w = &writer_impl.interface;
w.print("\neth.zig benchmarks (ReleaseFast)\n", .{}) catch {};
w.print("{s}\n", .{"=" ** 62}) catch {};
w.print("{s: <34} {s: >12} {s: >12}\n", .{ "Benchmark", "ops/sec", "ns/op" }) catch {};
w.print("{s}\n", .{"-" ** 62}) catch {};
for (results) |r| {
const ops = r.opsPerSec();
const ns = r.nsPerOp();
// Format ops/sec with comma separators
var ops_buf: [24]u8 = undefined;
const ops_str = formatWithCommas(ops, &ops_buf);
w.print("{s: <34} {s: >12} {d: >12}\n", .{ r.name, ops_str, ns }) catch {};
}
w.print("{s}\n", .{"=" ** 62}) catch {};
// Machine-readable JSON output for comparison script
w.print("\n", .{}) catch {};
for (results) |r| {
w.print("BENCH_JSON|{{\"name\":\"{s}\",\"ns_per_op\":{d},\"ops_per_sec\":{d}}}\n", .{
r.name, r.nsPerOp(), r.opsPerSec(),
}) catch {};
}
w.print("\n", .{}) catch {};
w.flush() catch {};
}
fn formatWithCommas(value: u64, out_buf: []u8) []const u8 {
if (value == 0) {
out_buf[0] = '0';
return out_buf[0..1];
}
// Write digits to a temp buffer (reversed order: least significant first)
var digits: [20]u8 = undefined;
var digit_count: usize = 0;
var v = value;
while (v > 0) {
digits[digit_count] = @intCast(v % 10 + '0');
digit_count += 1;
v /= 10;
}
// Write with commas. We iterate from the least significant digit,
// inserting a comma every 3 digits, then reverse the whole thing.
var tmp: [28]u8 = undefined; // 20 digits + up to 6 commas + slack
var pos: usize = 0;
for (0..digit_count) |i| {
if (i > 0 and i % 3 == 0) {
tmp[pos] = ',';
pos += 1;
}
tmp[pos] = digits[i];
pos += 1;
}
// Reverse into out_buf
for (0..pos) |i| {
out_buf[i] = tmp[pos - 1 - i];
}
return out_buf[0..pos];
}
// ============================================================================
// Test data (Anvil account 0 -- well-known test key)
// ============================================================================
const TEST_PRIVKEY: [32]u8 = .{
0xac, 0x09, 0x74, 0xbe, 0xc3, 0x9a, 0x17, 0xe3,
0x6b, 0xa4, 0xa6, 0xb4, 0xd2, 0x38, 0xff, 0x94,
0x4b, 0xac, 0xb4, 0x78, 0xcb, 0xed, 0x5e, 0xfc,
0xae, 0x78, 0x4d, 0x7b, 0xf4, 0xf2, 0xff, 0x80,
};
// keccak256("") -- a well-known hash
const TEST_MSG_HASH: [32]u8 = .{
0xc5, 0xd2, 0x46, 0x01, 0x86, 0xf7, 0x23, 0x3c,
0x92, 0x7e, 0x7d, 0xb2, 0xdc, 0xc7, 0x03, 0xc0,
0xe5, 0x00, 0xb6, 0x53, 0xca, 0x82, 0x27, 0x3b,
0x7b, 0xfa, 0xd8, 0x04, 0x5d, 0x85, 0xa4, 0x70,
};
const TEST_ADDR: [20]u8 = .{
0xf3, 0x9F, 0xd6, 0xe5, 0x1a, 0xad, 0x88, 0xF6,
0xF4, 0xce, 0x6a, 0xB8, 0x82, 0x72, 0x79, 0xcf,
0xfF, 0xb9, 0x22, 0x66,
};
// BIP-39 test seed from "abandon" x11 + "about"
const TEST_SEED: [64]u8 = .{
0x5e, 0xb0, 0x0b, 0xbd, 0xdc, 0xf0, 0x69, 0x08,
0x48, 0x89, 0xa8, 0xab, 0x91, 0x55, 0x56, 0x81,
0x65, 0xf5, 0xc4, 0x53, 0xcc, 0xb8, 0x5e, 0x70,
0x81, 0x1a, 0xae, 0xd6, 0xf6, 0xda, 0x5f, 0xc1,
0x9a, 0x5a, 0xc4, 0x0b, 0x38, 0x9c, 0xd3, 0x70,
0xd0, 0x86, 0x20, 0x6d, 0xec, 0x8a, 0xa6, 0xc4,
0x3d, 0xae, 0xa6, 0x69, 0x0f, 0x20, 0xad, 0x3d,
0x8d, 0x48, 0xb2, 0xd2, 0xce, 0x9e, 0x38, 0xe4,
};
// Precomputed selector for transfer(address,uint256)
const TRANSFER_SELECTOR: [4]u8 = .{ 0xa9, 0x05, 0x9c, 0xbb };
// Pre-encoded data for decode benchmarks (initialized in main)
var precomputed_abi_dynamic: []const u8 = &.{};
var precomputed_rlp_u256: []const u8 = &.{};
var precomputed_pubkey: [65]u8 = undefined;
// ============================================================================
// Benchmark functions -- Keccak256
// ============================================================================
fn benchKeccakEmpty() void {
const data: [0]u8 = .{};
const result = eth.keccak.hash(&data);
std.mem.doNotOptimizeAway(&result);
}
fn benchKeccak32() void {
const data: [32]u8 = TEST_MSG_HASH;
const result = eth.keccak.hash(&data);
std.mem.doNotOptimizeAway(&result);
}
fn benchKeccak256b() void {
const data: [256]u8 = .{0xAB} ** 256;
const result = eth.keccak.hash(&data);
std.mem.doNotOptimizeAway(&result);
}
fn benchKeccak1k() void {
const data: [1024]u8 = .{0xAB} ** 1024;
const result = eth.keccak.hash(&data);
std.mem.doNotOptimizeAway(&result);
}
fn benchKeccak4k() void {
const data: [4096]u8 = .{0xAB} ** 4096;
const result = eth.keccak.hash(&data);
std.mem.doNotOptimizeAway(&result);
}
// ============================================================================
// Benchmark functions -- secp256k1
// ============================================================================
fn benchSecp256k1Sign() void {
const sig = eth.secp256k1.sign(TEST_PRIVKEY, TEST_MSG_HASH) catch unreachable;
std.mem.doNotOptimizeAway(&sig);
}
fn benchSecp256k1Recover() void {
const sig = eth.secp256k1.sign(TEST_PRIVKEY, TEST_MSG_HASH) catch unreachable;
const pubkey = eth.secp256k1.recover(sig, TEST_MSG_HASH) catch unreachable;
std.mem.doNotOptimizeAway(&pubkey);
}
// ============================================================================
// Benchmark functions -- Address
// ============================================================================
fn benchAddressDerivation() void {
const addr = eth.secp256k1.pubkeyToAddress(precomputed_pubkey);
std.mem.doNotOptimizeAway(&addr);
}
fn benchAddressFromHex() void {
var hex_str: []const u8 = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266";
std.mem.doNotOptimizeAway(&hex_str);
const addr = eth.primitives.addressFromHex(hex_str) catch unreachable;
std.mem.doNotOptimizeAway(&addr);
}
fn benchChecksumAddress() void {
const addr = TEST_ADDR;
const checksum = eth.primitives.addressToChecksum(&addr);
std.mem.doNotOptimizeAway(&checksum);
}
// ============================================================================
// Benchmark functions -- ABI encoding
// ============================================================================
fn benchAbiEncodeTransfer(allocator: std.mem.Allocator) void {
const args = [_]eth.abi_encode.AbiValue{
.{ .address = TEST_ADDR },
.{ .uint256 = 1_000_000_000_000_000_000 },
};
const result = eth.abi_encode.encodeFunctionCall(allocator, TRANSFER_SELECTOR, &args) catch unreachable;
defer allocator.free(result);
std.mem.doNotOptimizeAway(result.ptr);
}
fn benchAbiEncodeStatic(allocator: std.mem.Allocator) void {
const args = [_]eth.abi_encode.AbiValue{
.{ .address = TEST_ADDR },
.{ .uint256 = 1_000_000_000_000_000_000 },
};
const result = eth.abi_encode.encodeValues(allocator, &args) catch unreachable;
defer allocator.free(result);
std.mem.doNotOptimizeAway(result.ptr);
}
fn benchAbiEncodeDynamic(allocator: std.mem.Allocator) void {
const array_items = [_]eth.abi_encode.AbiValue{
.{ .uint256 = 1 },
.{ .uint256 = 2 },
.{ .uint256 = 3 },
.{ .uint256 = 4 },
.{ .uint256 = 5 },
};
const args = [_]eth.abi_encode.AbiValue{
.{ .string = "The quick brown fox jumps over the lazy dog" },
.{ .bytes = "hello world, this is a dynamic bytes benchmark test payload" },
.{ .array = &array_items },
};
const result = eth.abi_encode.encodeValues(allocator, &args) catch unreachable;
defer allocator.free(result);
std.mem.doNotOptimizeAway(result.ptr);
}
// ============================================================================
// Benchmark functions -- ABI decoding
// ============================================================================
fn benchAbiDecodeUint256(allocator: std.mem.Allocator) void {
const encoded: [32]u8 = .{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0D, 0xE0, 0xB6, 0xB3, 0xA7, 0x64, 0x00, 0x00,
};
const types = [_]eth.abi_types.AbiType{.uint256};
const values = eth.abi_decode.decodeValues(&encoded, &types, allocator) catch unreachable;
defer eth.abi_decode.freeValues(values, allocator);
std.mem.doNotOptimizeAway(values.ptr);
}
fn benchAbiDecodeDynamic(allocator: std.mem.Allocator) void {
const types = [_]eth.abi_types.AbiType{ .string, .bytes };
const values = eth.abi_decode.decodeValues(precomputed_abi_dynamic, &types, allocator) catch unreachable;
defer eth.abi_decode.freeValues(values, allocator);
std.mem.doNotOptimizeAway(values.ptr);
}
// ============================================================================
// Benchmark functions -- RLP
// ============================================================================
fn benchRlpEncodeTx(allocator: std.mem.Allocator) void {
const tx = eth.transaction.Transaction{
.eip1559 = .{
.chain_id = 1,
.nonce = 42,
.max_priority_fee_per_gas = 2_000_000_000,
.max_fee_per_gas = 100_000_000_000,
.gas_limit = 21000,
.to = TEST_ADDR,
.value = 1_000_000_000_000_000_000,
.data = &.{},
.access_list = &.{},
},
};
const serialized = eth.transaction.serializeForSigning(allocator, tx) catch unreachable;
defer allocator.free(serialized);
std.mem.doNotOptimizeAway(serialized.ptr);
}
fn benchRlpDecodeU256() void {
const decoded = eth.rlp.decode(u256, precomputed_rlp_u256) catch unreachable;
std.mem.doNotOptimizeAway(&decoded.value);
}
// ============================================================================
// Benchmark functions -- u256 arithmetic
// ============================================================================
fn benchU256Add() void {
var a: u256 = 1_000_000_000_000_000_000;
var b: u256 = 997_000_000_000_000_000;
std.mem.doNotOptimizeAway(&a);
std.mem.doNotOptimizeAway(&b);
const result = a +% b;
std.mem.doNotOptimizeAway(&result);
}
fn benchU256Mul() void {
var a: u256 = 1_000_000_000_000_000_000;
var b: u256 = 997;
std.mem.doNotOptimizeAway(&a);
std.mem.doNotOptimizeAway(&b);
const result = a *% b;
std.mem.doNotOptimizeAway(&result);
}
fn benchU256Div() void {
var a: u256 = 997_000_000_000_000_000_000;
var b: u256 = 1_000_000_000_000_000_000;
std.mem.doNotOptimizeAway(&a);
std.mem.doNotOptimizeAway(&b);
const result = eth.uint256.fastDiv(a, b);
std.mem.doNotOptimizeAway(&result);
}
fn benchU256UniswapV2AmountOut() void {
var amount_in: u256 = 1_000_000_000_000_000_000; // 1 ETH
var reserve_in: u256 = 100_000_000_000_000_000_000; // 100 ETH
var reserve_out: u256 = 200_000_000_000; // 200k USDC (6 decimals)
// Single barrier covers all inputs (avoids 3 separate memory clobbers)
asm volatile (""
:
: [a] "r" (&amount_in),
[b] "r" (&reserve_in),
[c] "r" (&reserve_out),
: .{ .memory = true });
// Use limb-based compound function that avoids __udivti3
const amount_out = eth.uint256.getAmountOut(amount_in, reserve_in, reserve_out);
std.mem.doNotOptimizeAway(&amount_out);
}
fn benchU256MulDiv() void {
// FullMath.mulDiv: (a * b) / c with 512-bit intermediate
// Common pattern in UniswapV3/V4 SqrtPriceMath
var a: u256 = 1_000_000_000_000_000_000; // 1e18 liquidity
var b: u256 = 79228162514264337593543950336; // ~1.0 sqrtPriceX96
var c: u256 = 1_000_000_000_000_001_000; // liquidity + amountIn
asm volatile (""
:
: [a] "r" (&a),
[b] "r" (&b),
[c] "r" (&c),
: .{ .memory = true });
const result = eth.uint256.mulDiv(a, b, c);
std.mem.doNotOptimizeAway(&result);
}
fn benchU256UniswapV4Swap() void {
// UniswapV4 getNextSqrtPriceFromAmount0RoundingUp:
// sqrtPriceNext = liquidity * sqrtPriceX96 / (liquidity + amount * sqrtPriceX96)
var liquidity: u256 = 1_000_000_000_000_000_000; // 1e18
var sqrt_price: u256 = 79228162514264337593543950336; // ~1.0 in Q96
var amount_in: u256 = 1_000_000_000_000_000; // 0.001 ETH
asm volatile (""
:
: [a] "r" (&liquidity),
[b] "r" (&sqrt_price),
[c] "r" (&amount_in),
: .{ .memory = true });
// Step 1: amount * sqrtPrice (may overflow u256 so use mulDiv path)
const product = eth.uint256.fastMul(amount_in, sqrt_price);
// Step 2: denominator = liquidity + product
const denominator = liquidity +% product;
// Step 3: numerator = liquidity * sqrtPrice / denominator (full precision)
const next_sqrt_price = eth.uint256.mulDiv(liquidity, sqrt_price, denominator);
std.mem.doNotOptimizeAway(&next_sqrt_price);
}
// ============================================================================
// Benchmark functions -- Hex
// ============================================================================
fn benchHexEncode32() void {
const data: [32]u8 = TEST_MSG_HASH;
const result = eth.hex.bytesToHexBuf(32, &data);
std.mem.doNotOptimizeAway(&result);
}
fn benchHexDecode32() void {
var hex_str: []const u8 = "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";
std.mem.doNotOptimizeAway(&hex_str);
var buf: [32]u8 = undefined;
_ = eth.hex.hexToBytes(&buf, hex_str) catch unreachable;
std.mem.doNotOptimizeAway(&buf);
}
// ============================================================================
// Benchmark functions -- Transaction
// ============================================================================
fn benchTxHashEip1559(allocator: std.mem.Allocator) void {
const tx = eth.transaction.Transaction{
.eip1559 = .{
.chain_id = 1,
.nonce = 42,
.max_priority_fee_per_gas = 2_000_000_000,
.max_fee_per_gas = 100_000_000_000,
.gas_limit = 21000,
.to = TEST_ADDR,
.value = 1_000_000_000_000_000_000,
.data = &.{},
.access_list = &.{},
},
};
const hash = eth.transaction.hashForSigning(allocator, tx) catch unreachable;
std.mem.doNotOptimizeAway(&hash);
}
// ============================================================================
// Benchmark functions -- HD Wallet
// ============================================================================
fn benchHdWalletDerive10() void {
const master = eth.hd_wallet.masterKeyFromSeed(TEST_SEED) catch unreachable;
for (0..10) |i| {
const child = eth.hd_wallet.deriveChild(master, @intCast(i)) catch unreachable;
std.mem.doNotOptimizeAway(&child);
}
}
// ============================================================================
// Benchmark functions -- EIP-712
// ============================================================================
fn benchEip712Hash(allocator: std.mem.Allocator) void {
const domain = eth.eip712.DomainSeparator{
.name = "TestDApp",
.version = "1",
.chain_id = 1,
.verifying_contract = TEST_ADDR,
};
const transfer_type = eth.eip712.TypeDef{
.name = "Transfer",
.fields = &.{
.{ .name = "to", .type_str = "address" },
.{ .name = "amount", .type_str = "uint256" },
},
};
const message = eth.eip712.StructValue{
.type_name = "Transfer",
.fields = &.{
.{ .name = "to", .type_str = "address", .value = .{ .address = TEST_ADDR } },
.{ .name = "amount", .type_str = "uint256", .value = .{ .uint256 = 1_000_000_000_000_000_000 } },
},
};
const result = eth.eip712.hashTypedData(
allocator,
domain,
message,
&.{transfer_type},
) catch unreachable;
std.mem.doNotOptimizeAway(&result);
}
// ============================================================================
// Main
// ============================================================================
pub fn main() !void {
const allocator = std.heap.c_allocator;
// Pre-compute data for decode benchmarks
const abi_dyn_args = [_]eth.abi_encode.AbiValue{
.{ .string = "The quick brown fox jumps over the lazy dog" },
.{ .bytes = "hello world, this is a dynamic bytes benchmark test payload" },
};
const abi_dyn_encoded = try eth.abi_encode.encodeValues(allocator, &abi_dyn_args);
precomputed_abi_dynamic = abi_dyn_encoded;
const rlp_encoded = try eth.rlp.encode(allocator, @as(u256, 1_000_000_000_000_000_000));
precomputed_rlp_u256 = rlp_encoded;
// Pre-compute public key for address derivation benchmark
precomputed_pubkey = eth.secp256k1.derivePublicKey(TEST_PRIVKEY) catch unreachable;
const WARMUP = 100;
const ITERS = 10_000;
const SIGN_ITERS = 1_000;
const TX_ITERS = 5_000;
const results = [_]BenchResult{
// Keccak256
bench("keccak256_empty", WARMUP, ITERS, benchKeccakEmpty),
bench("keccak256_32b", WARMUP, ITERS, benchKeccak32),
bench("keccak256_256b", WARMUP, ITERS, benchKeccak256b),
bench("keccak256_1kb", WARMUP, ITERS, benchKeccak1k),
bench("keccak256_4kb", WARMUP, ITERS, benchKeccak4k),
// secp256k1
bench("secp256k1_sign", WARMUP, SIGN_ITERS, benchSecp256k1Sign),
bench("secp256k1_sign_recover", WARMUP, SIGN_ITERS, benchSecp256k1Recover),
// Address
bench("address_derivation", WARMUP, SIGN_ITERS, benchAddressDerivation),
bench("address_from_hex", WARMUP, ITERS, benchAddressFromHex),
bench("checksum_address", WARMUP, ITERS, benchChecksumAddress),
// ABI encoding
benchAlloc("abi_encode_transfer", WARMUP, ITERS, allocator, benchAbiEncodeTransfer),
benchAlloc("abi_encode_static", WARMUP, ITERS, allocator, benchAbiEncodeStatic),
benchAlloc("abi_encode_dynamic", WARMUP, ITERS, allocator, benchAbiEncodeDynamic),
// ABI decoding
benchAlloc("abi_decode_uint256", WARMUP, ITERS, allocator, benchAbiDecodeUint256),
benchAlloc("abi_decode_dynamic", WARMUP, ITERS, allocator, benchAbiDecodeDynamic),
// RLP
benchAlloc("rlp_encode_eip1559_tx", WARMUP, ITERS, allocator, benchRlpEncodeTx),
bench("rlp_decode_u256", WARMUP, ITERS, benchRlpDecodeU256),
// u256 arithmetic
bench("u256_add", WARMUP, ITERS, benchU256Add),
bench("u256_mul", WARMUP, ITERS, benchU256Mul),
bench("u256_div", WARMUP, ITERS, benchU256Div),
bench("u256_uniswapv2_amount_out", WARMUP, ITERS, benchU256UniswapV2AmountOut),
bench("u256_mulDiv", WARMUP, ITERS, benchU256MulDiv),
bench("u256_uniswapv4_swap", WARMUP, ITERS, benchU256UniswapV4Swap),
// Hex
bench("hex_encode_32b", WARMUP, ITERS, benchHexEncode32),
bench("hex_decode_32b", WARMUP, ITERS, benchHexDecode32),
// Transaction
benchAlloc("tx_hash_eip1559", WARMUP, TX_ITERS, allocator, benchTxHashEip1559),
// HD Wallet (eth-zig only)
bench("hd_wallet_derive_10", WARMUP, SIGN_ITERS, benchHdWalletDerive10),
// EIP-712 (eth-zig only)
benchAlloc("eip712_hash_typed_data", WARMUP, ITERS, allocator, benchEip712Hash),
};
printResults(&results);
}