[webkit-changes] [WebKit/WebKit] 3483dc: Optimize HTML parser entity names table by omittin...

Darin Adler noreply at github.com
Wed Mar 15 22:41:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3483dcf98d883183eb0621479ed8f19451533722
      https://github.com/WebKit/WebKit/commit/3483dcf98d883183eb0621479ed8f19451533722
  Author: Darin Adler <darin at apple.com>
  Date:   2023-03-15 (Wed, 15 Mar 2023)

  Changed paths:
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/html/parser/HTMLEntityParser.cpp
    M Source/WebCore/html/parser/HTMLEntitySearch.cpp
    M Source/WebCore/html/parser/HTMLEntitySearch.h
    M Source/WebCore/html/parser/HTMLEntityTable.h
    M Source/WebCore/html/parser/create-html-entity-table

  Log Message:
  -----------
  Optimize HTML parser entity names table by omitting semicolons
https://bugs.webkit.org/show_bug.cgi?id=253358
rdar://problem/106264459

Reviewed by Chris Dumez.

Crunched the table further using bitfields and omitting semicolons.

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
Added create-html-entity-table so searches will see source code there.

* Source/WebCore/html/parser/HTMLEntityParser.cpp:
(WebCore::HTMLEntityParser::consumeNamedEntity): Updated for the changes
to HTMLEntityTableEntry.
(WebCore::appendUChar32ToUCharArray): Deleted.
(WebCore::decodeNamedEntityToUCharArray): Use U16_APPEND_UNSAFE instead of
our own appendUChar32ToUCharArray.

* Source/WebCore/html/parser/HTMLEntitySearch.cpp:
(WebCore::midpoint): Renamed from halfway.
(WebCore::HTMLEntitySearch::compare const): Added code that can compare
with the semicolon even though it's not actually stored in the HTML entity table.

* Source/WebCore/html/parser/HTMLEntitySearch.h: Tweaked coding style
and names a bit.

* Source/WebCore/html/parser/HTMLEntityTable.h: Renamed all the members of
HTMLEntityTableEntry for clarity. There are two sets of characters, the name
of the entity, and the expansion of the entity, and the names must disambiguate.
The new entries fit in 57 bits with bit fields. Possible could crunc more if we
could save one more bit.

* Source/WebCore/html/parser/create-html-entity-table:
Write out the new table fields, omit semicolons. Check values fit in bit fields.

Canonical link: https://commits.webkit.org/261734@main




More information about the webkit-changes mailing list