-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Feature: forgetti/runtime
#2
Comments
This proposal looks good! Just some thoughts and questions:
const div = <div>foo</div>;
function Component() {
return div
}
|
As you know, forgetti generates a root cache at the component which is what powers the memoization process. The thing with this is that it is sophisticated to work for branched statements ( The problem with other hook-like functions is that right now, You can read more about it here: https://github.com/lxsmnsyc/forgetti#branched-caching
Currently const effects = useComposedEffect(useEffect, size);
effects[0] = [myEffect, dependencies];
Yeah this is probably something I missed. Currently
This one is for pre-wrapping the components by the memo API before being passed to the VDOM object. Funnily enough I think it wouldn't work w/o explicitly defining the
Yeah but take note though that I think million relies on serializable data. |
This is a thread discussing the introduction of
forgetti/runtime
, which would provide APIs that aren't achievable alone by the compiler.$$equals(a, b)
Object.is
is the slowest of the three comparison methods, the other being==
and===
.equal
provides a short path to allow using referential equality on non-number types.Ideal implementation would look like:
$$cache(useMemo, size)
$$effect(effectHook, index, callback, dependency)
$$cache
$$childCache(size)
$$memo(memoHoc, Component, keys)
Template splitting
This is still a pending design. The aim is for to split the template part from the logical part, producing a stateless memoized component. The design has the following considerations:
Splitting strategies
Per-element split
This solution aims to split every JSX element to be a standalone memoized component. This is definitely granular, but may consume too much memory
Singular template split
This solution only splits for the top-level JSX element. It has the same memoization process as the first solution except that the entirety is now grouped and is probably cheaper.
Component reference checking
This solution only applies memoization for potentially unmemoized components. The split creates a wrapper component at top-level and uses
$$memo
. Under the hood,$$memo
decides if it should memoized the component by checking some key properties (either checking the component's name via React or assigning a symbol).New JSX runtime
Maybe worth looking at?
Inspiration:
The text was updated successfully, but these errors were encountered: