Opened 16 months ago

Last modified 16 months ago

#6222 new change

[emscripten] Consider using of Copy-on-Write for Filter and Subscription classes

Reported by: sergz Assignee:
Priority: Unknown Milestone:
Module: Core Keywords:
Cc: hfiguiere Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description

Background

Beside simplifying the architecture and reducing the number of places for bugs it has a real demand backed by performance requirements. Sometimes we need a frozen state of a Subscription object, including its list of filters, e.g. in order to properly serialize it (#5138). On the other hand, Filter classes are supposed to be immutable by design because a Filter object can be only constructed from a string and cannot be modified afterwards. For subscriptions it's similar, in particular for mostly used DownloadableSubscription.

However current JS Filter classes have setters for hitCount and lastHit, and emscripten Subscription has mutable listed property.

What to do

Firstly we need to decide what is more important for us, then take into account the consequences of each approach and document how and why we plan to implement it then do it.

Additional notes

  • Since there is no need for allocation of a wrapper around internally held pointer, we might want to not operate by something like FilterPtr but rather just Filter in C++ interface and the corresponding JS bindings should be aware about it.
  • Take into account thread-safeness, const methods as well as CoW should be thread safe in the native applications.

Change History (1)

comment:1 Changed 16 months ago by kzar

  • Cc kzar removed
Note: See TracTickets for help on using tickets.