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=

Review URL: https://codereview.chromium.org/199103002

git-svn-id: svn://svn.chromium.org/blink/trunk@169438 bbb929c8-8fbe-4397-9dbb-9b2b20218538
4 files changed
tree: 115e8d30341197a55c80e33a2825f14d1e74f03b
  1. third_party/