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

Reimplement the core without Sets, Maps, etc. #161

Merged
merged 71 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
f923b76
Implement core without Sets, Maps, Arrays etc.
jviide Sep 13, 2022
7e7c9dc
Rename currentTarget to evalContext
jviide Sep 13, 2022
06d3c9c
Add a comment explaining why effect returns bound functions
jviide Sep 13, 2022
d61016d
Add Signal.subscribe back
jviide Sep 13, 2022
ec3467d
Code cleanup
jviide Sep 13, 2022
c914029
Unsubscribe from dropped dependencies only after subscribing to new ones
jviide Sep 13, 2022
3a37f2e
Fix computed invalidation
jviide Sep 13, 2022
44d91d4
Expose _doNotUseOrYouWillBeFired_Capture
jviide Sep 13, 2022
3e93e94
Expose Effect instance in effect callback's `this`
jviide Sep 13, 2022
de1de41
Fix, make effects implicit batches
jviide Sep 13, 2022
91a4ed9
Test fixes
jviide Sep 13, 2022
8c05a14
Throw correct error when trying to set computed.value
jviide Sep 13, 2022
4cc4edb
Update a couple of tests to account for computed signal laziness
jviide Sep 13, 2022
5e8b2f4
Remove an obsolete core test
jviide Sep 13, 2022
a9380e6
Update core graph tests to assume computed signals are pure
jviide Sep 13, 2022
c7a43b4
Add cycle detection for effects
jviide Sep 13, 2022
b635844
Fix remaining test
jviide Sep 13, 2022
34f7433
Throw a cycle error when the current batch handler hasn't settled aft…
jviide Sep 13, 2022
a69540d
Minor type cleanup
jviide Sep 14, 2022
f10c23f
Optimize subscription logic
jviide Sep 14, 2022
347ea41
Avoid creating rollback items in trivial cases
jviide Sep 14, 2022
9d3f884
Modify signal tracking logic
jviide Sep 14, 2022
0aaba28
Recycle linked list nodes
jviide Sep 14, 2022
d31bbf5
Use Effect object themselves as batching linked list
jviide Sep 14, 2022
805393a
Remove separate rollback buffer, use nodes to remember signal's previ…
jviide Sep 14, 2022
76b4df3
Add explicit checks for undefined-ness
jviide Sep 14, 2022
974dab7
Fix computed error-handling related issues
jviide Sep 14, 2022
6e84a61
Add basic computed signal tests
jviide Sep 14, 2022
f994098
Add dependency cycle tests
jviide Sep 14, 2022
02f8b40
Add tests
jviide Sep 14, 2022
a7ace11
Fix a invalidity propagation in specific cases
jviide Sep 14, 2022
58ed823
Move Effect._end into an external function
jviide Sep 15, 2022
0d58188
Rename Effect._notify to ._callback
jviide Sep 15, 2022
1a27bfe
Rename internal methods
jviide Sep 15, 2022
e1238d6
Fix internal flags
jviide Sep 15, 2022
22cb567
Add _running flag to Effects
jviide Sep 15, 2022
1609b2d
Use bit flags internally in Computed
jviide Sep 15, 2022
088b584
Use bit flags internally in Effect
jviide Sep 15, 2022
3cff272
Keep dependencies in order
jviide Sep 15, 2022
ff86040
Remove subscribeDepth from global state
jviide Sep 15, 2022
2e437a4
Use bit flags for Nodes
jviide Sep 15, 2022
915fa02
Refactor
jviide Sep 15, 2022
8c08ead
Save bytes by not implementing Computed.value setter
jviide Sep 15, 2022
3522c82
Add a couple of explicit undefinedness checks
jviide Sep 15, 2022
2e7ed9a
Minor code cleanup
jviide Sep 15, 2022
af202ee
Fix, don't export Computed
jviide Sep 15, 2022
9e581de
Optimize effect creation
jviide Sep 15, 2022
9d837e8
fix misnamed variable in #136
developit Sep 15, 2022
dd83204
Update Preact integration for #136
developit Sep 15, 2022
e42199e
Update React integration for #136
developit Sep 15, 2022
7bdfbc1
Add all missing properties to mangle.json
developit Sep 15, 2022
38139e8
avoid collision between Effect._callback and Effect._compute
developit Sep 15, 2022
8ea2aa9
Add missing _updaters prop to mangle
developit Sep 15, 2022
32a7c7f
Fix: hide Computed internals
jviide Sep 16, 2022
70bc14a
Add tests for effect disposal
jviide Sep 16, 2022
0834499
Throw when disposing a running effect
jviide Sep 16, 2022
8aad3a1
Fix: always reset effect state in batch handler
jviide Sep 16, 2022
2bfe375
Add core tests for internals that the integrations depend on
jviide Sep 16, 2022
212d0c1
Add test for internal effect._sources behavior
jviide Sep 16, 2022
b5ed584
Fix core tests
jviide Sep 16, 2022
4a6288a
Merge pull request #136 from jviide/setless-core
jviide Sep 16, 2022
f3c2c19
Fix mangle.json formatting
marvinhagemeister Sep 16, 2022
babcedb
Merge pull request #156 from preactjs/setless-integrations
marvinhagemeister Sep 16, 2022
d6c3bee
Prettier and slight optimization for Signal.toString
developit Sep 16, 2022
9d91d3e
Remove an accidentally added scratchpad file
jviide Sep 16, 2022
3e9c07d
Merge pull request #159 from preactjs/setless-cleanup
jviide Sep 16, 2022
71d3fbe
Support auto-disposing nested effects
jviide Sep 16, 2022
52f8f1d
Merge pull request #157 from preactjs/setless-prettier
marvinhagemeister Sep 16, 2022
a367a31
Add changeset
marvinhagemeister Sep 16, 2022
378a9d4
Merge pull request #158 from preactjs/nested-effects
marvinhagemeister Sep 16, 2022
6ac6923
Add core changeset
marvinhagemeister Sep 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/heavy-turkeys-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@preact/signals-core": minor
---

Add support for auto-disposing nested effects
7 changes: 7 additions & 0 deletions .changeset/shiny-jars-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@preact/signals-core": patch
"@preact/signals": patch
"@preact/signals-react": patch
---

Remove all usages of `Set`, `Map` and other allocation heavy objects in signals-core. This substaintially increases performance across all measurements.
41 changes: 30 additions & 11 deletions mangle.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,36 @@
"props": {
"cname": 6,
"props": {
"$_value": "_v",
"$_deps": "_d",
"$_subs": "_s",
"$_pending": "_p",
"$_updater": "_u",
"$_setCurrent": "_",
"$_activate": "_a",
"$_isComputing": "_c",
"$_readonly": "_r",
"$_requiresUpdate": "_q",
"$_props": "__"
"core: Node": "",
"$_source": "s",
"$_prevSource": "p",
"$_nextSource": "n",
"$_target": "t",
"$_prevTarget": "e",
"$_nextTarget": "x",
"$_rollbackNode": "r",
"core: Signal": "",
"$_value": "v",
"$_node": "n",
"$_targets": "t",
"core: Computed": "",
"$_compute": "v",
"$_globalVersion": "g",
"core: Effect": "",
"$_callback": "c",
"$_nextEffect": "e",
"$_start": "S",
"$_dispose": "d",
"core: Computed+Effect": "",
"$_sources": "s",
"$_notify": "N",
"core: Signal+Node+Computed+Effect": "",
"$_flags": "f",
"$_version": "i",
"$_subscribe": "S",
"$_unsubscribe": "U",
"preact": "",
"$_updaters": "U"
}
}
}
Loading