Currently we add empty / noop observers to keep the sampled signal started. That's fine, but it inflates the array of the sampled signal's observers for no reason. Since these noop observers have no payload, we could instead increment / decrement a noopObservers counter. We'll need to provide public noop Observer and InternalObserver instances to compare against when adding an observer, and make sure to use them.
This will cost us one Javascipt Number (64-bit) per every observable. Well, maybe we make it js.UndefOr[Int] to avoid that.
Anyway, just a small perf improvement for certain uses, for when I'm in the mood.
Currently we add empty / noop observers to keep the sampled signal started. That's fine, but it inflates the array of the sampled signal's observers for no reason. Since these noop observers have no payload, we could instead increment / decrement a
noopObservers
counter. We'll need to provide public noopObserver
andInternalObserver
instances to compare against when adding an observer, and make sure to use them.This will cost us one Javascipt Number (64-bit) per every observable. Well, maybe we make it
js.UndefOr[Int]
to avoid that.Anyway, just a small perf improvement for certain uses, for when I'm in the mood.