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

split jsoo toplevel into web-worker #135

Merged
merged 4 commits into from Oct 5, 2021

Conversation

patricoferris
Copy link
Contributor

This PR aims to partially fix #133 and #127 by moving the jsoo execution to a web worker which makes the chunk of the code easier to lazy load, execution of OCaml code doesn't block the main UI thread, easy to terminate the worker if there is no response in a certain amount of time (here 10s). It also gives the toplevel a bit of a different UI just to work in the idea of having to load the toplevel runtime code in. The initial JS loaded into the homepage is now (after dune build --profile release) ~80kB gzipped (~213kB otherwise) which is better (we could probably go further, but perhaps in a separate PR)

Toplevel after loading the home page

Screenshot 2021-10-05 at 18 22 21

Toplevel after clicking load and entering a few expressions

Screenshot 2021-10-05 at 18 23 24

Copy link
Collaborator

@tmattio tmattio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks so good! 🤩

The user experience looks great and we'll really see the difference in terms of performance.

I do have a slight preference for a dark-themed top level, but we can revisit it when we come back on the design of the homepage.

Feel free to merge when you feel this is ready!

@patricoferris
Copy link
Contributor Author

macOS errors are probably from ocaml/opam-repository#19676

@patricoferris patricoferris merged commit 4a55936 into ocaml:main Oct 5, 2021
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.

Lazily load the homage toplevel
2 participants