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

Issue 199103002: Better storage of HTML entities. (Closed)

Created:
6 years, 9 months ago by Daniel Bratell
Modified:
6 years, 9 months ago
CC:
blink-reviews, dglazkov+blink, adamk+blink_chromium.org, vanihegde, Yoav Weiss
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

The entity table contained pointers which both makes it big and prevents it from being reused as-is from the binary. This changes it to make the storage more compact by replacing pointers with offsets into a shared string. Also switching to more compact data types. The new database will look like: static const LChar staticEntityStringStorage[] = { 'A', 'E', 'l', 'i', 'g', ';', 'A', 'M', 'P', ';', 'A', 'a', 'c', 'u', 't', 'e', ';', ... static const HTMLEntityTableEntry staticEntityTable[2231] = { { 0x000C6, 0, 0, 5 }, // &AElig { 0x000C6, 0, 0, 6 }, // Æ { 0x00026, 0, 6, 3 }, // &AMP { 0x00026, 0, 6, 4 }, // & { 0x000C1, 0, 10, 6 }, // &Aacute ... The binary will shrink by about 20-35 KB (depending on architecture), the memory usage should shrink by similar numbers for every renderer (since the memory now can be shared between renderers) and there will be a tiny startup time improvement due to fewer relocation blocks and less to read from disk. It accomplishes the savings by avoiding pointers in the data (resolving pointers during startup is expensive), using one string instead of 2000+, not storing the trailing NUL byte, ordering the members for minimum padding, using minimal size data types and reusing the same string space for things like "amp;" and "amp". BUG=352141 R= Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=169438

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+109 lines, -41 lines) Patch
M Source/core/html/parser/HTMLEntityParser.cpp View 2 chunks +5 lines, -4 lines 0 comments Download
M Source/core/html/parser/HTMLEntitySearch.cpp View 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/html/parser/HTMLEntityTable.h View 2 chunks +7 lines, -4 lines 0 comments Download
M Source/core/html/parser/create-html-entity-table View 5 chunks +95 lines, -32 lines 1 comment Download

Messages

Total messages: 12 (0 generated)
Daniel Bratell
abarth, could you please look at this size/memory/startup time optimization? (Asking you since you reviewed ...
6 years, 9 months ago (2014-03-13 14:20:34 UTC) #1
abarth-chromium
Neat! LGTM One question about the build-time cost of this search below. https://codereview.chromium.org/199103002/diff/1/Source/core/html/parser/create-html-entity-table File Source/core/html/parser/create-html-entity-table ...
6 years, 9 months ago (2014-03-17 17:37:27 UTC) #2
eseidel
Very cool. I suspect we have many other instances of static data which we're needlessly ...
6 years, 9 months ago (2014-03-17 17:42:34 UTC) #3
Daniel Bratell
On a computer that is slower than most the script running time has gone from ...
6 years, 9 months ago (2014-03-17 19:55:21 UTC) #4
abarth-chromium
60ms is fine :)
6 years, 9 months ago (2014-03-17 20:11:52 UTC) #5
Daniel Bratell
The CQ bit was checked by bratell@opera.com
6 years, 9 months ago (2014-03-18 08:09:15 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bratell@opera.com/199103002/1
6 years, 9 months ago (2014-03-18 08:09:17 UTC) #7
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-18 08:12:17 UTC) #8
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.blink on win_blink_rel
6 years, 9 months ago (2014-03-18 08:12:17 UTC) #9
Daniel Bratell
The CQ bit was checked by bratell@opera.com
6 years, 9 months ago (2014-03-18 09:25:40 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bratell@opera.com/199103002/1
6 years, 9 months ago (2014-03-18 09:25:45 UTC) #11
commit-bot: I haz the power
6 years, 9 months ago (2014-03-18 10:05:35 UTC) #12
Message was sent while issue was closed.
Change committed as 169438

Powered by Google App Engine
This is Rietveld 408576698