Skip to content

Commit fd1ef4f

Browse files
committed
Clarify repeated-row benchmark cases
1 parent 9af1768 commit fd1ef4f

2 files changed

Lines changed: 34 additions & 32 deletions

File tree

packages/effect/benchmark/schema/SchemaBinary.md

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ The streaming setup compares the closest public decode paths. SchemaBinary reuse
1414

1515
SchemaBinary uses length-prefixed frames, NDJSON includes one newline byte per frame, and Msgpack concatenates self-delimiting values. Fragmented inputs split after the first byte. Stream compression is applied to the complete concatenated stream.
1616

17+
The `200-row array payload` case uses `Schema.Array(LargeRow)`, so one value is an array containing 200 rows. A one-shot operation encodes or decodes that entire array. Its streaming batch contains 32 frames with the same 200-row array, or 6,400 row occurrences in total. The `200 single-row frames` case uses `LargeRow` directly and sends the 200 distinct rows as 200 frames. Streaming throughput is decoded values per second: arrays per second for the first case and rows per second for the second. Multiply the array rate by 200 to compare decoded row throughput.
18+
1719
## Payload size
1820

1921
Cells contain raw / gzip -6 / zstd bytes.
@@ -25,19 +27,19 @@ Cells contain raw / gzip -6 / zstd bytes.
2527
| collections | 1452 / 792 / 776 | 1438 / 776 / 758 | 1828 / 671 / 660 | 1462 / 788 / 805 |
2628
| index signatures / 128 | 2251 / 689 / 656 | 2258 / 697 / 665 | 2235 / 573 / 559 | 2203 / 676 / 629 |
2729
| index signatures / 512 | 9355 / 2373 / 2189 | 9362 / 2383 / 2197 | 9531 / 2266 / 2074 | 9287 / 2544 / 2304 |
28-
| large repeated records | 27646 / 3065 / 3175 | 19454 / 2766 / 2701 | 57529 / 3230 / 3008 | 51283 / 3516 / 3320 |
30+
| 200-row array payload | 27646 / 3065 / 3175 | 19454 / 2766 / 2701 | 57529 / 3230 / 3008 | 51283 / 3516 / 3320 |
2931

3032
Streaming cells contain total raw / gzip -6 / zstd bytes for the complete stream.
3133

32-
| Case | Frames | SchemaBinary | Fingerprint | Msgpack | NDJSON |
33-
| -------------------------- | -----: | --------------------: | --------------------: | --------------------: | ---------------------: |
34-
| small record | 32 | 1856 / 95 / 75 | 1120 / 65 / 51 | 2240 / 111 / 87 | 2880 / 123 / 98 |
35-
| nested payload | 32 | 10176 / 391 / 305 | 6592 / 259 / 208 | 10880 / 369 / 306 | 14528 / 399 / 315 |
36-
| collections | 32 | 46464 / 1122 / 793 | 46016 / 1102 / 776 | 47424 / 1130 / 813 | 58528 / 1079 / 676 |
37-
| index signatures / 128 | 32 | 72032 / 1229 / 669 | 72256 / 1270 / 678 | 71008 / 1252 / 649 | 71552 / 1073 / 540 |
38-
| index signatures / 512 | 32 | 299360 / 5528 / 2227 | 299584 / 5528 / 2235 | 297696 / 5775 / 2037 | 305024 / 5831 / 1829 |
39-
| large repeated records | 32 | 884672 / 14110 / 3259 | 622528 / 12524 / 2765 | 623488 / 12335 / 2736 | 1840960 / 87481 / 3226 |
40-
| per-frame repeated records | 200 | 27840 / 3109 / 3174 | 21240 / 2876 / 2733 | 51520 / 2956 / 2888 | 57528 / 3230 / 3019 |
34+
| Case | Frames | SchemaBinary | Fingerprint | Msgpack | NDJSON |
35+
| ---------------------- | -----: | --------------------: | --------------------: | --------------------: | ---------------------: |
36+
| small record | 32 | 1856 / 95 / 75 | 1120 / 65 / 51 | 2240 / 111 / 87 | 2880 / 123 / 98 |
37+
| nested payload | 32 | 10176 / 391 / 305 | 6592 / 259 / 208 | 10880 / 369 / 306 | 14528 / 399 / 315 |
38+
| collections | 32 | 46464 / 1122 / 793 | 46016 / 1102 / 776 | 47424 / 1130 / 813 | 58528 / 1079 / 676 |
39+
| index signatures / 128 | 32 | 72032 / 1229 / 669 | 72256 / 1270 / 678 | 71008 / 1252 / 649 | 71552 / 1073 / 540 |
40+
| index signatures / 512 | 32 | 299360 / 5528 / 2227 | 299584 / 5528 / 2235 | 297696 / 5775 / 2037 | 305024 / 5831 / 1829 |
41+
| 200-row array payload | 32 | 884672 / 14110 / 3259 | 622528 / 12524 / 2765 | 623488 / 12335 / 2736 | 1840960 / 87481 / 3226 |
42+
| 200 single-row frames | 200 | 27840 / 3109 / 3174 | 21240 / 2876 / 2733 | 51520 / 2956 / 2888 | 57528 / 3230 / 3019 |
4143

4244
## One-shot throughput
4345

@@ -50,7 +52,7 @@ Average encode operations per second:
5052
| collections | 35,376 | 35,651 | 21,778 | 22,134 |
5153
| index signatures / 128 | 14,096 | 14,167 | 35,928 | 35,077 |
5254
| index signatures / 512 | 2,871 | 2,867 | 6,508 | 6,314 |
53-
| large repeated records | 6,995 | 8,128 | 6,125 | 4,038 |
55+
| 200-row array payload | 6,995 | 8,128 | 6,125 | 4,038 |
5456

5557
Average decode operations per second:
5658

@@ -61,33 +63,33 @@ Average decode operations per second:
6163
| collections | 39,697 | 39,708 | 20,723 | 21,943 |
6264
| index signatures / 128 | 20,589 | 20,675 | 28,624 | 29,884 |
6365
| index signatures / 512 | 4,988 | 4,969 | 5,411 | 4,562 |
64-
| large repeated records | 7,233 | 7,934 | 5,630 | 4,761 |
66+
| 200-row array payload | 7,233 | 7,934 | 5,630 | 4,761 |
6567

6668
## Streaming decode throughput
6769

6870
Average decoded values per second for batched input:
6971

70-
| Case | Default | Fingerprint | Msgpack | NDJSON |
71-
| -------------------------- | --------: | ----------: | ------: | ------: |
72-
| small record | 4,385,709 | 5,493,837 | 901,253 | 849,385 |
73-
| nested payload | 819,281 | 977,777 | 284,386 | 306,687 |
74-
| collections | 118,938 | 119,806 | 21,189 | 20,364 |
75-
| index signatures / 128 | 58,715 | 58,699 | 27,863 | 28,431 |
76-
| index signatures / 512 | 8,374 | 8,322 | 4,055 | 5,064 |
77-
| large repeated records | 11,147 | 12,996 | 6,345 | 4,953 |
78-
| per-frame repeated records | 2,127,598 | 2,382,278 | 856,723 | 946,703 |
72+
| Case | Default | Fingerprint | Msgpack | NDJSON |
73+
| ---------------------- | --------: | ----------: | ------: | ------: |
74+
| small record | 4,385,709 | 5,493,837 | 901,253 | 849,385 |
75+
| nested payload | 819,281 | 977,777 | 284,386 | 306,687 |
76+
| collections | 118,938 | 119,806 | 21,189 | 20,364 |
77+
| index signatures / 128 | 58,715 | 58,699 | 27,863 | 28,431 |
78+
| index signatures / 512 | 8,374 | 8,322 | 4,055 | 5,064 |
79+
| 200-row array payload | 11,147 | 12,996 | 6,345 | 4,953 |
80+
| 200 single-row frames | 2,127,598 | 2,382,278 | 856,723 | 946,703 |
7981

8082
Average decoded values per second for single and first-byte-fragmented input:
8183

82-
| Case | Default single | Default fragmented | Fingerprint single | Fingerprint fragmented | NDJSON single | NDJSON fragmented |
83-
| -------------------------- | -------------: | -----------------: | -----------------: | ---------------------: | ------------: | ----------------: |
84-
| small record | 2,585,851 | 2,296,255 | 3,131,403 | 2,871,336 | 137,242 | 142,477 |
85-
| nested payload | 710,222 | 699,114 | 836,484 | 826,233 | 109,985 | 108,842 |
86-
| collections | 116,964 | 116,132 | 117,837 | 116,882 | 18,463 | 18,438 |
87-
| index signatures / 128 | 57,343 | 57,974 | 58,448 | 58,763 | 24,688 | 24,643 |
88-
| index signatures / 512 | 8,414 | 8,704 | 8,793 | 8,619 | 5,218 | 5,195 |
89-
| large repeated records | 11,419 | 11,474 | 13,312 | 13,295 | 5,206 | 5,127 |
90-
| per-frame repeated records | 1,390,397 | 1,369,513 | 1,594,590 | 1,512,635 | 130,684 | 127,909 |
84+
| Case | Default single | Default fragmented | Fingerprint single | Fingerprint fragmented | NDJSON single | NDJSON fragmented |
85+
| ---------------------- | -------------: | -----------------: | -----------------: | ---------------------: | ------------: | ----------------: |
86+
| small record | 2,585,851 | 2,296,255 | 3,131,403 | 2,871,336 | 137,242 | 142,477 |
87+
| nested payload | 710,222 | 699,114 | 836,484 | 826,233 | 109,985 | 108,842 |
88+
| collections | 116,964 | 116,132 | 117,837 | 116,882 | 18,463 | 18,438 |
89+
| index signatures / 128 | 57,343 | 57,974 | 58,448 | 58,763 | 24,688 | 24,643 |
90+
| index signatures / 512 | 8,414 | 8,704 | 8,793 | 8,619 | 5,218 | 5,195 |
91+
| 200-row array payload | 11,419 | 11,474 | 13,312 | 13,295 | 5,206 | 5,127 |
92+
| 200 single-row frames | 1,390,397 | 1,369,513 | 1,594,590 | 1,512,635 | 130,684 | 127,909 |
9193

9294
## Analysis
9395

packages/effect/benchmark/schema/SchemaBinary.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const cases = [
140140
value: metrics(512)
141141
},
142142
{
143-
name: "large repeated records",
143+
name: "200-row array payload",
144144
schema: LargePayload,
145145
value: largeRows
146146
}
@@ -364,7 +364,7 @@ const preparedStreams = await Promise.all([
364364
name: testCase.name,
365365
prepared: prepareStream(testCase.schema, Array.from({ length: streamBatchSize }, () => testCase.value))
366366
})),
367-
{ name: "per-frame repeated records", prepared: prepareStream(LargeRow, largeRows) }
367+
{ name: "200 single-row frames", prepared: prepareStream(LargeRow, largeRows) }
368368
].map(async ({ name, prepared }) => ({ name, ...await prepared })))
369369

370370
console.log(`Node ${process.version}; codec and schema construction excluded from timings.`)

0 commit comments

Comments
 (0)