Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Issue 1058003005: Mime sniffer: reduce table from 256 bytes to 4 (Closed)

Created:
5 years, 8 months ago by Adam Rice
Modified:
4 years, 3 months ago
Reviewers:
asanka, PhistucK
CC:
cbentzel+watch_chromium.org, chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mime 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+204 lines, -27 lines) Patch
M net/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M net/base/mime_sniffer.h View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
M net/base/mime_sniffer.cc View 1 2 3 4 3 chunks +21 lines, -27 lines 0 comments Download
A net/base/mime_sniffer_perftest.cc View 1 2 3 4 5 6 7 1 chunk +107 lines, -0 lines 0 comments Download
M net/base/mime_sniffer_unittest.cc View 1 2 3 2 chunks +67 lines, -0 lines 0 comments Download
M net/net.gyp View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 21 (9 generated)
PhistucK
5 years, 8 months ago (2015-04-27 14:27:14 UTC) #2
Adam Rice
+asanka The perftests aren't really necessary. I will remove them if you prefer. See also ...
5 years, 7 months ago (2015-04-28 02:43:08 UTC) #4
asanka
Since you've done some microbenchmarking, have you compared this patchset with just adding the 'byte ...
5 years, 7 months ago (2015-04-29 23:17:44 UTC) #5
Adam Rice
https://codereview.chromium.org/1058003005/diff/40001/net/base/mime_sniffer.cc File net/base/mime_sniffer.cc (right): https://codereview.chromium.org/1058003005/diff/40001/net/base/mime_sniffer.cc#newcode660 net/base/mime_sniffer.cc:660: static const uint32 kBinaryBits = 0xf7ffc9ff; On 2015/04/29 23:17:44, ...
5 years, 7 months ago (2015-05-07 16:52:50 UTC) #6
asanka
lgtm. Thanks for doing this! https://codereview.chromium.org/1058003005/diff/40001/net/base/mime_sniffer_perftest.cc File net/base/mime_sniffer_perftest.cc (right): https://codereview.chromium.org/1058003005/diff/40001/net/base/mime_sniffer_perftest.cc#newcode15 net/base/mime_sniffer_perftest.cc:15: TEST(MimeSnifferTest, FastPathPerfTest) { On ...
5 years, 7 months ago (2015-05-12 19:20:41 UTC) #7
Adam Rice
https://codereview.chromium.org/1058003005/diff/100001/net/base/mime_sniffer_perftest.cc File net/base/mime_sniffer_perftest.cc (right): https://codereview.chromium.org/1058003005/diff/100001/net/base/mime_sniffer_perftest.cc#newcode87 net/base/mime_sniffer_perftest.cc:87: plaintext.reserve(kTargetSize + plaintext.size() % kTargetSize); On 2015/05/12 19:20:41, asanka ...
5 years, 7 months ago (2015-05-18 01:02:57 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1058003005/120001
5 years, 7 months ago (2015-05-18 01:03:13 UTC) #11
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_x64_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/58457)
5 years, 7 months ago (2015-05-18 02:05:22 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1058003005/140001
5 years, 7 months ago (2015-05-18 20:24:08 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1058003005/140001
5 years, 7 months ago (2015-05-19 18:44:44 UTC) #19
commit-bot: I haz the power
Committed patchset #8 (id:140001)
5 years, 7 months ago (2015-05-19 18:52:04 UTC) #20
commit-bot: I haz the power
5 years, 7 months ago (2015-05-19 18:53:59 UTC) #21
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/10eb9f5e836087e3c0324043221d217af56d30e2
Cr-Commit-Position: refs/heads/master@{#330577}

Powered by Google App Engine
This is Rietveld 408576698