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

Minify/optimise JS output #52

Open
rrthomas opened this issue Apr 21, 2024 · 0 comments
Open

Minify/optimise JS output #52

rrthomas opened this issue Apr 21, 2024 · 0 comments

Comments

@rrthomas
Copy link
Collaborator

rrthomas commented Apr 21, 2024

I tried this with node-minify, which uses uglify-js under the hood. It achieves decent compression (50%), but minimal speed-up.

I tried removing the run-time type-checks for assignment: this gave a decent reduction in size (compressed and uncompressed), but no significant improvement in runtime (for Hailstone sequence test).

I considered removing unused variables, but I can see from VS Code highlighting that there aren't that many.

Significant gains in speed will require more complex optimisation; obvious candidates are:

  • Unboxing of ArkNull, ArkBoolean, ArkNumber, ArkString and ArkFn.
  • Relatedly, reducing the number of JavaScript function calls per Ursa function call.

Both of these would be likely to be necessary in any compilation scheme, as it's hard to imagine a third-party optimisation pass that would supply these optimisations automatically, unless by compiling Ursa to a language sufficiently similar that has its own optimising compiler; e.g. Crystal.

On the plus side, it should be very quick to whip up back-ends targeting other high-level languages, so it would be cheap to make experiments like this.

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

No branches or pull requests

1 participant