Bug 143490

Summary: optimize content extension interpreting
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: WebCore Misc.Assignee: Alex Christensen <achristensen>
Severity: Normal CC: benjamin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Description Flags
Patch beidson: review+

Description Alex Christensen 2015-04-07 11:39:20 PDT
There are some simple optimizations that make things a lot faster:
  Not interpreting data urls.  These can be many kilobytes of base64 encoded things like images.
  When jumping to the DFA root, don't re-add all the actions.  We handle the actions from the root in special optimized ways, anyway.
Comment 1 Alex Christensen 2015-04-07 11:42:16 PDT
Created attachment 250280 [details]
Comment 2 Alex Christensen 2015-04-07 12:00:44 PDT
Created attachment 250281 [details]
Comment 3 Alex Christensen 2015-04-07 14:18:51 PDT
Comment 4 Benjamin Poulain 2015-04-07 14:19:43 PDT
View in context: https://bugs.webkit.org/attachment.cgi?id=250281&action=review

> Source/WebCore/contentextensions/ContentExtensionsBackend.cpp:80
> +    if (resourceLoadInfo.resourceURL.protocolIsData()
> +        || resourceLoadInfo.resourceURL.protocolIsJavaScript())

This could be on a single line.

> Source/WebCore/contentextensions/ContentExtensionsBackend.cpp:130
> +    WTFLogAlways("Time added: %f microseconds %s", (addedTimeEnd - addedTimeStart) * 1.0e6, resourceLoadInfo.resourceURL.string().utf8().data());

Isn't that a bit too verbose? Maybe printing the average after every 100 urls would be easier to work with?

> Source/WebCore/contentextensions/DFABytecodeCompiler.cpp:113
> +    // If we jump to the root, we don't want to re-add its actions to a HashSet.
> +    // We know we have already added them because the root is always compiled first and we always start interpreting at the beginning.

That's a good point!
Comment 5 Alex Christensen 2015-04-07 15:52:55 PDT
Touching URL.h broke things.  Undid that in http://trac.webkit.org/changeset/182500