DescriptionMime sniffer: reduce table from 256 bytes to 4
The lookup table for sniffing text/plain messages for binary characters
was 256 bytes in size. The information it encoded could be stored in 32
bits.
Use a 32-bit lookup table instead of the 256-byte lookup table. This
reduces binary size.
This change is mostly performance neutral; micro-benchmarks show
no statistically significant change on Android. Micro-benchmarks on
high-performance Intel processors show an additional cost of around
400ns, apparently due to branch mis-prediction.
However, real-world performance is likely to be dominated by the time taken to
load the table into CPU cache, which the new implementation should win
easily.
Also add a micro-benchmark test.
BUG=
TEST=net_unittests
Committed: https://crrev.com/10eb9f5e836087e3c0324043221d217af56d30e2
Cr-Commit-Position: refs/heads/master@{#330577}
Patch Set 1 #Patch Set 2 : Fix android compile, add slow path test. #Patch Set 3 : Add unit tests for ContainsControlCodes() #
Total comments: 7
Patch Set 4 : Give kBinaryBits a clearer definition. #Patch Set 5 : Compile fix for Windows. #Patch Set 6 : Add plain text perf test. #
Total comments: 2
Patch Set 7 : Fix calculation of the string reserve size. #Patch Set 8 : Compile fix for MSVC 64-bit #
Messages
Total messages: 21 (9 generated)
|