Skip to content

Commit 1571eed

Browse files
committed
Replace dead overflow checks with assertions and avoid indirect call overhead
We allocate twice the input length, and every input character results in either 1 or 2 output bytes, so we cannot overflow. By using an enum, and a switch table (which will be efficiently compiled into a jump table), we can avoid the pessimistic code generation of the indirect calls. With this I get the following runtime for the test script in GH-13466 on my i7-4790, which is around 1.25x faster. Time (mean ± σ): 250.9 ms ± 1.6 ms [User: 248.4 ms, System: 2.0 ms] Range (min … max): 248.9 ms … 254.4 ms 11 runs
1 parent 3798966 commit 1571eed

File tree

2 files changed

+352
-302
lines changed

2 files changed

+352
-302
lines changed

0 commit comments

Comments
 (0)