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

0.5.0 #21

Merged
merged 53 commits into from
May 15, 2023
Merged

0.5.0 #21

merged 53 commits into from
May 15, 2023

Conversation

lxsmnsyc
Copy link
Owner

@lxsmnsyc lxsmnsyc commented May 14, 2023

This release adds the new optimization process. The 0.4.0 algorithm was a bit naive and will over memoize for expressions that barely need them. The new algorithm ensures a better memoization process by doing the following stages:

  1. Pre-inlining
    Variable declarations that can be inlined are recursively inlined. This allows the memoization step to know the largest possible constant expression and cache it in a single entry.
  2. Expansion
    Assignment expressions and hooks had issues in optimization in 0.4.x. With the expansion step, these expressions are now moved before the parent statement path, and ensures that these expressions are called out of their rules.
  3. Simplify
    Some expressions that are guaranteed to have literal evaluation are evaluated in compile-time.
  4. Memoize
    This is where the old core runs.
  5. Post-inlining
    Same process as step 1. This allows generated variables to be inlined so that there's less output.

Other changes:

@lxsmnsyc lxsmnsyc merged commit 7adfa3f into main May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rendered fewer hooks than expected. This may be caused by an accidental early return statement.
2 participants