Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web: send fewer, smaller events #89

Open
benknoble opened this issue Apr 23, 2024 · 1 comment
Open

Web: send fewer, smaller events #89

benknoble opened this issue Apr 23, 2024 · 1 comment
Labels
T:performance for performance-related topics

Comments

@benknoble
Copy link
Owner

The existing mechanism was a great proof of concept, but it is probably not the most performant solution (esp. when there are many monsters and many events).

The ideal solution probably has to cache the previous state and diff it against the current state to only send updates (inserts, updates, deletes). I have not found a suitable generic data structure diff library, so I'll have to handroll this for now.

I suspect this will be easier with #85 (which should be a huge performance win, too), so for now this depends on that.

@benknoble benknoble added the T:performance for performance-related topics label Apr 23, 2024
@benknoble
Copy link
Owner Author

Well, sexp-diff can do some of the work, but I think it does not recur into structure-types (nor, presumably, observables). It's also not exactly clear how to use that here.

Another possibility is as follows: if the problem is over-subscribed observables, why not reverse the protocol? The GUI can emit events that any program can subscribe to and handle. This forces the GUI code to decide what events to emit and at what (presumably logical) points. The undo functionality would also be a client of this system.

The mechanism could either be a logger or a multicast channel, as long as it's async & fire-and-forget (both are).

There's still a question of what to when consuming events (pass the state along?) and what the "initial" state for a request should be (same as current?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T:performance for performance-related topics
Projects
Status: Todo
Development

No branches or pull requests

1 participant