Bug 145526 - [Content Extensions] Reduce DFA memory usage.
Summary: [Content Extensions] Reduce DFA memory usage.
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-06-01 14:32 PDT by Alex Christensen
Modified: 2015-06-01 15:30 PDT (History)
0 users

See Also:


Attachments
Patch (10.77 KB, patch)
2015-06-01 14:34 PDT, Alex Christensen
benjamin: 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-06-01 14:32:47 PDT
std::pair<uint8_t, uint32_t> uses 8 bytes per transition, but we can reduce the memory usage of the DFA by about 3/8 by separating the characters from the destinations.
Comment 1 Alex Christensen 2015-06-01 14:34:23 PDT
Created attachment 254013 [details]
Patch
Comment 2 Benjamin Poulain 2015-06-01 15:24:11 PDT
Comment on attachment 254013 [details]
Patch

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

> Source/WebCore/contentextensions/DFA.cpp:43
> +        + transitionCharacters.size() * sizeof(uint8_t)
> +        + transitionDestinations.size() * sizeof(uint8_t)

This should be capacity(), not size().
Comment 3 Alex Christensen 2015-06-01 15:29:34 PDT
Comment on attachment 254013 [details]
Patch

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

>> Source/WebCore/contentextensions/DFA.cpp:43
>> +        + transitionDestinations.size() * sizeof(uint8_t)
> 
> This should be capacity(), not size().

And destinations are uint32_t.
Comment 4 Alex Christensen 2015-06-01 15:30:10 PDT
http://trac.webkit.org/changeset/185078