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

Refactor head_snapshot #832

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

scuml
Copy link
Contributor

@scuml scuml commented Dec 27, 2022

This modifies head_snapshot to sort elements by type as the snapshot is created resulting in less code, a more compact minimized codebase, and increased performance.

The current head snapshot comparison method compares all items in the header against themselves. This branch compares scripts to scripts, styles to styles, meta to meta, and so on. This allows for more efficient processing of items during merge. The primary benefit to this refactor is how it affects the size of the Turbo library - reducing the size of the minified code base by 1.3% (72.78k -> 71.84k).

@scuml
Copy link
Contributor Author

scuml commented Dec 28, 2022

Sean's recommendations bring the minimized package size down further to 71.79k or 1.36% smaller.

@scuml
Copy link
Contributor Author

scuml commented Feb 18, 2023

@seanpdoyle Tried once more to implement the grouping by class, but couldn't get typescript to accept my various attempts to generic-tize the elements array.

Would you be able to take a stab at it? Or can we consider merging this branch to realize the size & speed benefits for now, and attempt to make further optimizations later.

@scuml
Copy link
Contributor Author

scuml commented May 16, 2023

Bump for attention.

@scuml
Copy link
Contributor Author

scuml commented Sep 9, 2023

Typescript removed. Ready to go and a great candidate for Turbo 8.

Looking for review and approval.

@shiftyp
Copy link
Contributor

shiftyp commented Sep 9, 2023

Not planning on helping here too much, but I think your test is still in TS

@scuml
Copy link
Contributor Author

scuml commented Sep 9, 2023

Tests updated. Ready for review.

@scuml
Copy link
Contributor Author

scuml commented Nov 29, 2023

Verified: works great in Turbo 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants