haxetink / tink_state

Handle those pesky states.
The Unlicense
29 stars 13 forks source link

Reduce allocations. #69

Open back2dos opened 3 years ago

back2dos commented 3 years ago

While benchmarking vs. MobX, I've noticed tink_state taxes the GC quite a bit more. Haven't profiled it yet, but two things seem to stand out as relatively obvious:

  1. Invalidator is the basis of all things and it subscribes every Invalidatable only once. The usage of a CallbackList is therefore not necessary, and the allocation of the CallbackLink can be avoided in favor of a method to unsubscribe an Invalidatable (by identity) again.
  2. The data contained in SubscribtionTo can be inlined into AutoObservable.