Bug 146575 - [Content Extensions] Make the DFA transitions ranges instead of characters
Summary: [Content Extensions] Make the DFA transitions ranges instead of characters
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords:
: 146429 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-07-02 22:29 PDT by Benjamin Poulain
Modified: 2015-10-29 20:48 PDT (History)
3 users (show)

See Also:


Attachments
Patch (126.92 KB, patch)
2015-07-02 22:51 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (126.92 KB, patch)
2015-07-02 23:19 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (126.87 KB, patch)
2015-07-03 19:02 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (125.92 KB, patch)
2015-07-06 11:50 PDT, Alex Christensen
achristensen: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2015-07-02 22:29:16 PDT
[Content Extensions] Make the DFA transitions ranges instead of characters
Comment 1 Benjamin Poulain 2015-07-02 22:51:26 PDT
Created attachment 256075 [details]
Patch
Comment 2 WebKit Commit Bot 2015-07-02 22:53:47 PDT
Attachment 256075 [details] did not pass style-queue:


ERROR: Source/WebCore/contentextensions/DFACombiner.cpp:41:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
ERROR: Source/WebCore/contentextensions/DFACombiner.cpp:42:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
Total errors found: 2 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Benjamin Poulain 2015-07-02 23:19:22 PDT
Created attachment 256078 [details]
Patch
Comment 4 WebKit Commit Bot 2015-07-02 23:20:57 PDT
Attachment 256078 [details] did not pass style-queue:


ERROR: Source/WebCore/contentextensions/DFACombiner.cpp:41:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
ERROR: Source/WebCore/contentextensions/DFACombiner.cpp:42:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
Total errors found: 2 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Alex Christensen 2015-07-03 11:12:13 PDT
Comment on attachment 256078 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=256078&action=review

> Source/WebCore/contentextensions/DFABytecodeCompiler.cpp:208
> +    uint32 fallbackTransitionTarget = std::numeric_limits<uint32>::max();

uint32_t
Comment 6 Alex Christensen 2015-07-03 11:58:23 PDT
This reduces compile time from 22.4 to 6.9 seconds in a large test, reduces byte code size from 26.8MB to 25.3MB, and reduces DFA memory usage from ~32MB to ~6MB. Win Win Win!
Comment 7 Alex Christensen 2015-07-03 12:02:50 PDT
In another large test case, this reduces the compiling time from 5.8 to 4.4 seconds, but increases the byte code size from 14 to 19 MB.
Comment 8 Benjamin Poulain 2015-07-03 12:34:13 PDT
(In reply to comment #7)
> In another large test case, this reduces the compiling time from 5.8 to 4.4
> seconds, but increases the byte code size from 14 to 19 MB.

When comparing the final size, don't forget the previous minimizer was accidentally destroying information. The resulting DFA was not always correct.

The new minimizer always find the smallest DFA and does not fuck up the fallback transition :)

I have an idea to get back some of the size increase in the bytecode.
Comment 9 Benjamin Poulain 2015-07-03 19:02:47 PDT
Created attachment 256125 [details]
Patch
Comment 10 WebKit Commit Bot 2015-07-03 19:04:50 PDT
Attachment 256125 [details] did not pass style-queue:


ERROR: Source/WebCore/contentextensions/DFACombiner.cpp:41:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
ERROR: Source/WebCore/contentextensions/DFACombiner.cpp:42:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
Total errors found: 2 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Alex Christensen 2015-07-06 11:50:23 PDT
Created attachment 256227 [details]
Patch
Comment 12 WebKit Commit Bot 2015-07-06 11:52:26 PDT
Attachment 256227 [details] did not pass style-queue:


ERROR: Source/WebCore/contentextensions/DFACombiner.cpp:41:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
ERROR: Source/WebCore/contentextensions/DFACombiner.cpp:42:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
Total errors found: 2 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Alex Christensen 2015-07-06 11:53:01 PDT
Comment on attachment 256227 [details]
Patch

New patch for ews.  Still reviewing minimizer.
Comment 14 Alex Christensen 2015-07-06 13:01:00 PDT
Comment on attachment 256227 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=256227&action=review

> Source/WebCore/contentextensions/DFAMinimizer.cpp:103
> +        m_sets.append(SetDescriptor { start, size, 0 });

appendUnchecked?

> Source/WebCore/contentextensions/DFAMinimizer.cpp:373
> +            return 1;

This seems a little strange.

> Source/WebCore/contentextensions/DFANode.cpp:80
> +    // Transitions can contains "0" if the expression has a end-of-line marker.

"0" -> '\0'
Comment 15 Alex Christensen 2015-07-06 14:08:05 PDT
http://trac.webkit.org/changeset/186374
Comment 16 Alex Christensen 2015-10-29 20:48:42 PDT
*** Bug 146429 has been marked as a duplicate of this bug. ***