Changes between Initial Version and Version 2 of Ticket #4128

04/14/2017 07:01:25 AM (2 years ago)


  • Ticket #4128

    • Property Blocked By changed from to 5137
    • Property Summary changed from [emscripten] Convert parsing/serializing patterns.ini to C++ to [emscripten] Convert parsing patterns.ini to C++
  • Ticket #4128 – Description

    initial v2  
    11=== Background === 
    2 See #4122 for the rationale. While converting all of `FilterStorage` functionality to C++ isn't necessary, parsing/serializing patterns.ini definitely needs to happen in C++. 
     2See #4122 for the rationale. We should parse patterns.ini in C++ for better performance. 
    44=== What to change === 
    5 Create `INIParser()` and `INISerializer()` classes in C++. `INIParser()` should have methods `parse()` (parsing next chunk), `finalize()` (parse last chunk and replace existing filters/subscriptions) and `delete()` (release reference). No changes to existing data structures should be performed before `finalize()` is called. 
     5Create `compiled/storage/parser.cpp` providing a `Parser` class (should be exposed to JavaScript as `_FilterStorage_Parser`). The parser should allocate a 64kB (?) input buffer, with the pointer to the buffer being returned by its `buffer` property and its size by the `bufferSize` property. `FilterStorage.importData` (JavaScript, located in `lib/filterStorage.js`) should copy the incoming lines to the buffer, followed by a line break. Once there is no longer enough space in the buffer for the next line it should call `Parser.process(numChars)`. Upon receiving a null string (finalization), `FilterStorage.importData` should make the parser process data still in the buffer and call `Parser.finalize()` then - this will replace existing subscriptions. 
    7 `INISerializer()` should have the method `getChunk()` returning the next chunk of data to be written to disk and `delete()` (release reference). 
     7=== Notes === 
     8* `FilterStorage.importData()` needs to expose `_FilterStorage_Parser.delete()` - the parser needs to be deleted explicitly if parsing is abandoned. 
     9* The parser needs to keep a list with references to filters it processed. With the file format currently listing filters before subscriptions, the filters might get released otherwise and the changes of filter properties will be lost. 
     10* It is no longer feasible to prevent changes of filter/subscription properties before finalization. This should be ok as long as the list of subscriptions stays unchanged until finalization.