Commit 8262e35
committed
Optimize PagesSerde
Refactor PagesSerde to avoid:
- Unnecessary memory copy
- Unnecessary Cipher initialization
- Unnecessary allocations when jumbo pages (>4MB) are serialized
This is done by implementing block based encryption in compression.
Instead of trying to encrypt/compress an entire page a page in
serialized form is split into multiple fixed size blocks (64kb by
default)
Benchmark results
Before:
```
Benchmark (compressed) (encrypted) (randomSeed) Mode Cnt Score Error Units
BenchmarkPagesSerde.deserialize true true 1000 thrpt 10 1194.138 ± 7.442 ops/s
BenchmarkPagesSerde.deserialize true false 1000 thrpt 10 2281.985 ± 8.634 ops/s
BenchmarkPagesSerde.deserialize false true 1000 thrpt 10 1416.509 ± 2.928 ops/s
BenchmarkPagesSerde.deserialize false false 1000 thrpt 10 5891.232 ± 14.932 ops/s
BenchmarkPagesSerde.serialize true true 1000 thrpt 10 312.647 ± 0.800 ops/s
BenchmarkPagesSerde.serialize true false 1000 thrpt 10 601.053 ± 1.522 ops/s
BenchmarkPagesSerde.serialize false true 1000 thrpt 10 451.260 ± 0.996 ops/s
BenchmarkPagesSerde.serialize false false 1000 thrpt 10 3446.756 ± 6.949 ops/s
```
After:
```
Benchmark (compressed) (encrypted) (randomSeed) Mode Cnt Score Error Units
BenchmarkPagesSerde.deserialize true true 1000 thrpt 10 1732.440 ± 4.044 ops/s
BenchmarkPagesSerde.deserialize true false 1000 thrpt 10 3059.334 ± 5.412 ops/s
BenchmarkPagesSerde.deserialize false true 1000 thrpt 10 2093.146 ± 3.505 ops/s
BenchmarkPagesSerde.deserialize false false 1000 thrpt 10 5906.148 ± 13.923 ops/s
BenchmarkPagesSerde.serialize true true 1000 thrpt 10 329.150 ± 1.269 ops/s
BenchmarkPagesSerde.serialize true false 1000 thrpt 10 617.507 ± 1.808 ops/s
BenchmarkPagesSerde.serialize false true 1000 thrpt 10 493.182 ± 0.687 ops/s
BenchmarkPagesSerde.serialize false false 1000 thrpt 10 3816.939 ± 7.984 ops/s
```1 parent 3e31aaa commit 8262e35
File tree
26 files changed
+1291
-755
lines changed- core/trino-main/src
- main/java/io/trino
- execution
- buffer
- operator
- output
- server/protocol
- spiller
- util
- test/java/io/trino
- execution/buffer
- operator
- spiller
26 files changed
+1291
-755
lines changedLines changed: 3 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
60 | | - | |
61 | 59 | | |
62 | 60 | | |
63 | | - | |
64 | 61 | | |
65 | 62 | | |
66 | 63 | | |
| |||
97 | 94 | | |
98 | 95 | | |
99 | 96 | | |
100 | | - | |
101 | 97 | | |
102 | 98 | | |
| 99 | + | |
| 100 | + | |
103 | 101 | | |
104 | 102 | | |
105 | 103 | | |
| |||
280 | 278 | | |
281 | 279 | | |
282 | 280 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 281 | + | |
291 | 282 | | |
292 | 283 | | |
293 | 284 | | |
| |||
0 commit comments