Batch read/process/write
This is producing some interesting results, although is not yet optimized as it deserves, on my Intel Machine ` 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz` (yet to try with Ryzen, which has a much better branch predictor and can catch up much quickly in case of mispredict - but not on recent firmware changes,see https://chipsandcheese.com/p/turning-off-zen-4s-op-cache-for-curiosity for details)
```
Benchmark (size) (specialCharPercentage) Mode Cnt Score Error Units
MyBenchmark.benchReplaceBackslashTable3 65536 60 thrpt 20 4566.917 ± 24.556 ops/s
MyBenchmark.benchReplaceBackslash3 65536 60 thrpt 20 3594.101 ± 37.940 ops/s
MyBenchmark.benchReplaceBackslashRawCompressedTable3 65536 60 thrpt 20 11019.333 ± 42.942 ops/s
```
with `-prof perfnorm`:
```
Benchmark (size) (specialCharPercentage) Mode Cnt Score Error Units
MyBenchmark.benchReplaceBackslashTable3 65536 60 thrpt 20 4566.917 ± 24.556 ops/s
MyBenchmark.benchReplaceBackslashTable3:CPI 65536 60 thrpt 2 0.939 clks/insn
MyBenchmark.benchReplaceBackslashTable3:IPC 65536 60 thrpt 2 1.065 insns/clk
MyBenchmark.benchReplaceBackslashTable3:L1-dcache-load-misses 65536 60 thrpt 2 5470.803 #/op
MyBenchmark.benchReplaceBackslashTable3:L1-dcache-loads 65536 60 thrpt 2 132011.152 #/op
MyBenchmark.benchReplaceBackslashTable3:L1-dcache-stores 65536 60 thrpt 2 145568.515 #/op
MyBenchmark.benchReplaceBackslashTable3:L1-icache-load-misses 65536 60 thrpt 2 127.412 #/op
MyBenchmark.benchReplaceBackslashTable3:LLC-load-misses 65536 60 thrpt 2 2.154 #/op
MyBenchmark.benchReplaceBackslashTable3:LLC-loads 65536 60 thrpt 2 8.060 #/op
MyBenchmark.benchReplaceBackslashTable3:LLC-store-misses 65536 60 thrpt 2 0.091 #/op
MyBenchmark.benchReplaceBackslashTable3:LLC-stores 65536 60 thrpt 2 3.281 #/op
MyBenchmark.benchReplaceBackslashTable3:branch-misses 65536 60 thrpt 2 27423.588 #/op
MyBenchmark.benchReplaceBackslashTable3:branches 65536 60 thrpt 2 295364.506 #/op
MyBenchmark.benchReplaceBackslashTable3:cycles 65536 60 thrpt 2 1044546.105 #/op
MyBenchmark.benchReplaceBackslashTable3:dTLB-load-misses 65536 60 thrpt 2 0.773 #/op
MyBenchmark.benchReplaceBackslashTable3:dTLB-loads 65536 60 thrpt 2 131863.392 #/op
MyBenchmark.benchReplaceBackslashTable3:dTLB-store-misses 65536 60 thrpt 2 1.005 #/op
MyBenchmark.benchReplaceBackslashTable3:dTLB-stores 65536 60 thrpt 2 145470.646 #/op
MyBenchmark.benchReplaceBackslashTable3:iTLB-load-misses 65536 60 thrpt 2 1.417 #/op
MyBenchmark.benchReplaceBackslashTable3:instructions 65536 60 thrpt 2 1112095.791 #/op
Benchmark (size) (specialCharPercentage) Mode Cnt Score Error Units
MyBenchmark.benchReplaceBackslash3 65536 60 thrpt 20 3594.101 ± 37.940 ops/s
MyBenchmark.benchReplaceBackslash3:CPI 65536 60 thrpt 2 1.066 clks/insn
MyBenchmark.benchReplaceBackslash3:IPC 65536 60 thrpt 2 0.938 insns/clk
MyBenchmark.benchReplaceBackslash3:L1-dcache-load-misses 65536 60 thrpt 2 5494.986 #/op
MyBenchmark.benchReplaceBackslash3:L1-dcache-loads 65536 60 thrpt 2 66919.188 #/op
MyBenchmark.benchReplaceBackslash3:L1-dcache-stores 65536 60 thrpt 2 105956.829 #/op
MyBenchmark.benchReplaceBackslash3:L1-icache-load-misses 65536 60 thrpt 2 191.893 #/op
MyBenchmark.benchReplaceBackslash3:LLC-load-misses 65536 60 thrpt 2 0.857 #/op
MyBenchmark.benchReplaceBackslash3:LLC-loads 65536 60 thrpt 2 8.126 #/op
MyBenchmark.benchReplaceBackslash3:LLC-store-misses 65536 60 thrpt 2 0.069 #/op
MyBenchmark.benchReplaceBackslash3:LLC-stores 65536 60 thrpt 2 5.763 #/op
MyBenchmark.benchReplaceBackslash3:branch-misses 65536 60 thrpt 2 43692.881 #/op
MyBenchmark.benchReplaceBackslash3:branches 65536 60 thrpt 2 367635.003 #/op
MyBenchmark.benchReplaceBackslash3:cycles 65536 60 thrpt 2 1318290.030 #/op
MyBenchmark.benchReplaceBackslash3:dTLB-load-misses 65536 60 thrpt 2 0.662 #/op
MyBenchmark.benchReplaceBackslash3:dTLB-loads 65536 60 thrpt 2 66726.962 #/op
MyBenchmark.benchReplaceBackslash3:dTLB-store-misses 65536 60 thrpt 2 1.343 #/op
MyBenchmark.benchReplaceBackslash3:dTLB-stores 65536 60 thrpt 2 105941.118 #/op
MyBenchmark.benchReplaceBackslash3:iTLB-load-misses 65536 60 thrpt 2 1.591 #/op
MyBenchmark.benchReplaceBackslash3:instructions 65536 60 thrpt 2 1236818.773 #/op
Benchmark (size) (specialCharPercentage) Mode Cnt Score Error Units
MyBenchmark.benchReplaceBackslashRawCompressedTable3 65536 60 thrpt 20 11019.333 ± 42.942 ops/s
MyBenchmark.benchReplaceBackslashRawCompressedTable3:CPI 65536 60 thrpt 2 0.377 clks/insn
MyBenchmark.benchReplaceBackslashRawCompressedTable3:IPC 65536 60 thrpt 2 2.654 insns/clk
MyBenchmark.benchReplaceBackslashRawCompressedTable3:L1-dcache-load-misses 65536 60 thrpt 2 2750.466 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:L1-dcache-loads 65536 60 thrpt 2 82436.776 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:L1-dcache-stores 65536 60 thrpt 2 16585.568 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:L1-icache-load-misses 65536 60 thrpt 2 46.369 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:LLC-load-misses 65536 60 thrpt 2 0.829 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:LLC-loads 65536 60 thrpt 2 2.927 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:LLC-store-misses 65536 60 thrpt 2 0.069 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:LLC-stores 65536 60 thrpt 2 1.522 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:branch-misses 65536 60 thrpt 2 25.553 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:branches 65536 60 thrpt 2 33066.376 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:cycles 65536 60 thrpt 2 432460.457 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:dTLB-load-misses 65536 60 thrpt 2 0.250 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:dTLB-loads 65536 60 thrpt 2 82420.444 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:dTLB-store-misses 65536 60 thrpt 2 0.463 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:dTLB-stores 65536 60 thrpt 2 16592.661 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:iTLB-load-misses 65536 60 thrpt 2 1.638 #/op
MyBenchmark.benchReplaceBackslashRawCompressedTable3:instructions 65536 60 thrpt 2 1147638.902 #/op
```
As said: it requires some love to be optimized but as you can see, in case of many mispredict, the performance advantage over the "simple" table lookup case, is noteworthy
合并状态:已合并 合并于 2024-12-14 关闭于 2024-12-14 2 条评论