DEV Community

Cover image for Main aspects of reactivity

Main aspects of reactivity

Jin on November 11, 2021

Hello, my name is Dmitriy Karlovskiy, and I want to share with you the results of my 6-years research of reactivity to build a user interface. It ...
Collapse
 
3shain profile image
3Shain • Edited

Very informative.
My project is not yet to be released but it almost meets all your "Practicality" level, except it uses Object.is by default (it's a performance concern, while you can set up custom comparator)

Collapse
 
ninjin profile image
Jin

Sounds interesting, what about the documentation?

Collapse
 
3shain profile image
3Shain

I'm currently working on it. The APIs just become stable recently. (Actually I've started writing documents for months, and lots of problems were reflected so it was refactored several times). We can talk about details on discord maybe?

Thread Thread
 
ninjin profile image
Jin

My voice english is too bad for discord.
You may be interested in the $mol_wire approach, where adding/removing a dependency takes O(1). In short: all cells store not only link to peer, but position of back link inside peer array too.

Thread Thread
 
3shain profile image
3Shain • Edited

Typing text is OK πŸ˜‚ I speak poor English as well. I use the same algorithm before (so does s-js, solidjs). The reason why I choose linked list is, the dependencies list are often stable and ordered (and often only one dependency). So the optimization is to reuse the old list as many as possible. Ideally it will be just several read without write.
And I don't have to remove one specific dependency. If I found there is a mismatch, I will give up all remaining history records and build a new linked list from current cursor (and the remaining records will be cleanup later, in batch.)
So you can haveadd/remove O(1) , but what about no add/remove at allπŸ˜‰
(also I don't get it why you emphasise O(1), is double linked list manipulation not O(1)?)

Thread Thread
 
3shain profile image
3Shain

Wait I think there should be some contexts. I'm taking about dependency tracking but I think you are talking about something else. Because I'm not using a pubsub model, but scheduling and topological sort

Collapse
 
markerikson profile image
Mark Erikson

I just read through the auto-translated version of the post. Very impressive! You've clearly spent a lot of time thinking about this issue and coming up with categories. The diagrams were very helpful in understanding your ideas as well.

Would definitely love to see a fully-translated version of the post!