Changes between Initial Version and Version 1 of Ticket #7045


Ignore:
Timestamp:
10/15/2018 12:00:05 AM (12 months ago)
Author:
mjethani
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7045 – Description

    initial v1  
    11=== Background === 
    2 In EasyList+AA there are about 150 element hiding filters and exceptions of lengths exceeding 1,000 characters. Of these, about 20 are longer than 100,000 characters. Most of the filter text is the list of domains, and this list is repeated often. 
     2In EasyList+AA there are about 150 element hiding filters and exceptions of lengths exceeding 1,000 characters. Of these, about 20 are longer than 100,000 characters. Similarly, there are about 600 blocking and whitelist filters of lengths exceeding 1,000 characters, of which about 10 are longer than 100,000 characters. Most of the filter text is the list of domains, and this list is repeated often. 
    33 
    44The memory layout of this text can be optimized by restructuring it in the following manner: 
     
    1111In order for this to work on V8, we would have to override some of V8's own string optimizations that are sometimes harmful (V8 issue [https://bugs.chromium.org/p/v8/issues/detail?id=2869 #2869]). When we "slice" out a part of a string, we must properly separate it from its V8 internal parent string, using an operation like `JSON.parse(JSON.stringify(string))`. Once we are able to do this, we can restructure such long filter texts with a more efficient layout in memory. 
    1212 
    13 I have written a [https://codereview.adblockplus.org/29909576/ patch] that performs this optimization on content filters (element hiding, element hiding emulation, and snippet filters and exceptions) where the domains part of the text is 1,000 characters or longer. It reduces the initial heap used by ~1.9 MB, from ~39.6 MB to ~37.7 MB. 
     13I have written a [https://codereview.adblockplus.org/29909576/ patch] that performs this optimization on content filters (element hiding, element hiding emulation, and snippet filters and exceptions) where the domains part of the text is 1,000 characters or longer. It reduces the initial heap used by ~1.9 MB, from ~39.6 MB to ~37.7 MB. More pertinently, it reduces the memory occupied by all strings from ~16 MB down to ~14 MB. 
    1414 
    1515=== What to change ===