Opened 4 years ago

Last modified 8 months ago

#4128 closed change

[emscripten] Convert parsing patterns.ini to C++ — at Version 2

Reported by: trev Assignee:
Priority: P2 Milestone:
Module: Core Keywords: closed-in-favor-of-gitlab
Cc: Blocked By: #5137
Blocking: #4122 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by trev)


See #4122 for the rationale. We should parse patterns.ini in C++ for better performance.

What to change

Create 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.


  • FilterStorage.importData() needs to expose _FilterStorage_Parser.delete() - the parser needs to be deleted explicitly if parsing is abandoned.
  • 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.
  • 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.

Change History (2)

comment:1 Changed 3 years ago by trev

  • Blocked By 5137 added

comment:2 Changed 3 years ago by trev

  • Description modified (diff)
  • Summary changed from [emscripten] Convert parsing/serializing patterns.ini to C++ to [emscripten] Convert parsing patterns.ini to C++
Note: See TracTickets for help on using tickets.