Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DRAFT] Prototype use of autotracking to optimize subscription behavior#2047

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
markerikson wants to merge8 commits intomaster
base:master
Choose a base branch
Loading
fromfeature/tracking-subscriptions

Conversation

@markerikson
Copy link
Contributor

@markeriksonmarkerikson commentedJun 26, 2023
edited
Loading

This PR:

  • Has a totally WIP prototype POC reworking ofSubscription anduseSelector to try using autotracking to optimize subscription behavior and avoid executing subscriber+selector callbacks that we already know try to read state that didn't change.

For background on autotracking, see:

Notes:

  • This branch currently rewrites the existingSubscription.ts anduseSelector.ts files. My plan is that if I can get this working, I would instead copy-paste the logic into separatecreateTrackedSubscription anduseTrackedSelector files, and that you would enable the top-level tracking behavior by passing<Provider createSubscription={createTrackedSubscription}>. That way no one would have to pay the bundle size cost for the additional tracking logic unless they opt in,and all existinguseSelector usage stays exactly the same.
  • It assumes that the rootstate is an object, not a primitive. That should be the case in most apps. (Naturally, a bunch of our testsdo have just a primitive like0 as the state...)
  • The existinguseSelector test suite all passes. Either I've done something very right, or I've done something that has no use at all :)
  • I have no idea what the performance cost is of any of this right now, or how it behaves in a full real-world-sized state tree + thousands of components. I'll have to look into that next. I know that thisis doing a bunch of additional work at the top level to reconcile the new state tree vs the old one and mark fields as dirty. It's also having to do work to track dependencies and recalculate changed revisions, andthose are stillO(n). It's entirely possible everything I've got here is a waste of effort because you're still calling a ton of functions.

But now that I've gotsomething that appears to at least run and pass tests, I can start doing more investigation.

incepter, BrianHung, and guillaumebrunerie reacted with eyes emoji
@markeriksonmarkerikson marked this pull request as draftJune 26, 2023 19:22
@codesandbox-ci
Copy link

codesandbox-cibot commentedJun 26, 2023
edited
Loading

This pull request is automatically built and testable inCodeSandbox.

To see build info of the built libraries, clickhere or the icon next to each commit SHA.

Latest deployment of this branch, based on commitbbf7a4f:

SandboxSource
VanillaConfiguration
Vanilla TypescriptConfiguration

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@markerikson

[8]ページ先頭

©2009-2025 Movatter.jp