-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[WIP] Bitmask-based change tracking #3945
Conversation
Add another one bitmask? At least, PostgresDB does the same things for nulls in tuples. |
Maybe using bigint: |
BigInt isn't really an option, it's not supported widely enough. One day. The most likely option at this point is an array of bitmasks |
Getting there. All the |
Sometime in the past when discussing bitmasks, we'd mention having comments next to |
Yes. I've pushed a change to that effect, but... well: -if (dirty & 2) set_data(t4, ctx[1]);
+if (dirty & /* _id9uocqrtmw00_1_ */ 2) set_data(t4, ctx[1]); Not quite sure why it's not replacing the comment content — can't seem to reproduce inside code-red. |
okay fixed. i think this is basically done now? |
Do you think we could use comments where we're accessing |
yep — done |
It looks like the failing tests are from precisely those mysterious changes to style-related things in a few tests. It seems like something weird happened when you ran the tests locally to update the expected js samples? I have no idea. |
Pushed an update. I'm at a loss as to what could've happened. The tests pass locally for me now - hopefully they will here as well. |
#3977 was actually responsible for the weird I bet when you were running the tests locally just before committing the changes to the |
Good news — I just rebuilt svelte.dev with this branch, and the combined weight of all the minified JS chunks is 3.8% smaller. Zipped, the difference is less (1.3%), but still not nothing. Given how much of the weight of the site is accounted for by CodeMirror, I'm encouraged by these numbers. I haven't done any performance testing, but based on microbenchmarks of object lookups vs bitwise operations, this is basically guaranteed to be faster, especially since we're no longer constantly changing the shape of the I'll merge this in, and then maybe start testing another hypothesis: since it's now nice and easy to say 'everything changed' (by setting the bitmask to |
These changes look great! Smaller bundle size and better performance. They do cause an issue with svelte-devtools though. Now that the ctx object is a simple array I have no way to map the values back to their original names. For example, previously a user might see something like this
Now in 3.16 they would instead see
I'm not sure how to solve this. Could some sort of ctx index to local name map be exposed in dev mode, similar to how the props work? Devtools is still "usable" you can still see and change the state it's just completely unnamed. Let me know if you have any ideas. |
@RedHatter I think that's the right approach, yeah (a lookup provided in dev mode). Mind raising an issue? (for future reference: I don't get email notifications of activity on issues and PRs, so comments on stuff that's closed/merged are very likely to pass me by. I only happened to see this because of an ancient open tab 😀 ) |
@Rich-Harris
I confuse about why 32bit integer only represent up to 31 values? Isn't it 32 values? I know the most significant bit set 1 will cause this number negative, but that seems no matter, we don't need compare the number sign, we just use I also look through this comments and #1943 comments, no one seems to have mentioned it, only @mrkishi provide follow code example:
but this code suppose one number present 32 values ( in current source, the function function make_dirty(component, i) {
if (component.$$.dirty[0] === -1) {
dirty_components.push(component);
schedule_update();
component.$$.dirty.fill(0);
}
component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
} So, I want to know if there are other reason that 32bit only present 31 values. |
Another crack at #1943. First task is to confirm that it's possible and see how it affects the output; after that, need to figure out how to handle components with more than 31 changeable top-level values