Bug 143490 - optimize content extension interpreting
Summary: optimize content extension interpreting
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-07 11:39 PDT by Alex Christensen
Modified: 2015-04-07 15:52 PDT (History)
1 user (show)

See Also:


Attachments
Patch (6.56 KB, patch)
2015-04-07 11:42 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (7.33 KB, patch)
2015-04-07 12:00 PDT, Alex Christensen
beidson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
Patch
Comment 2 Alex Christensen 2015-04-07 12:00:44 PDT
Created attachment 250281 [details]
Patch
Comment 3 Alex Christensen 2015-04-07 14:18:51 PDT
http://trac.webkit.org/changeset/182492
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