Bug 145526

Summary: [Content Extensions] Reduce DFA memory usage.
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: WebCore Misc.Assignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch benjamin: review+

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