rename command to elm-optimize-more

This commit is contained in:
mdgriffith 2020-08-21 19:05:52 -04:00
parent 928be54743
commit 6464535d18
4 changed files with 20 additions and 20 deletions

View File

@ -4,7 +4,7 @@
**Note, Experimental** - _This project is just starting. While we currently believe every adjustment to the resulting javascript should be safe and make things explicitly faster, it's hard to be 100% certain until we have a large number of projects using it successfully. So, beware!_
_And let us know how it goes by leaving [a comment in this issue](https://github.com/mdgriffith/elm-optimize/issues/15)._ :smiley:
_And let us know how it goes by leaving [a comment in this issue](https://github.com/mdgriffith/elm-optimize-more/issues/15)._ :smiley:
Elm is fast.
@ -25,13 +25,13 @@ There are two parts to this.
## Installation and Usage
```
npm install -g elm-optimize
npm install -g elm-optimize-more
```
Then you can use `elm-optimize` just as you would `elm-make --optimize`.
Then you can use `elm-optimize-more` just as you would `elm-make --optimize`.
```
elm-optimize Main.elm
elm-optimize-more Main.elm
```
will generate an `elm.js` file.
@ -39,12 +39,12 @@ will generate an `elm.js` file.
The only configurable option is what to name the generated js file.
```
elm-optimize Main.elm --output app.js
elm-optimize-more Main.elm --output app.js
```
**Note** — elm-optimize only generates a js file, it doesn't support generating HTML.
**Note** — elm-optimize-more only generates a js file, it doesn't support generating HTML.
**Another Note** — Before deploying your app, you should also minify it and gzip it. `elm-optimize` does not do that for you. [Check out this doc for a recommended setup.](notes/minification.md)
**Another Note** — Before deploying your app, you should also minify it and gzip it. `elm-optimize-more` does not do that for you. [Check out this doc for a recommended setup.](notes/minification.md)
## What's actually happening?
@ -58,7 +58,7 @@ A few are listed there as either incomplete or not attempted. That's future work
## Benchmarks
**Note** — _These results are really exciting! However, it's not totally obvious that your project will see similar gains. Performance is a tricky beast! If you do see significant speedups in your project, [leave a comment here on this issue](https://github.com/mdgriffith/elm-optimize/issues/15), we love to see realworld cases._
**Note** — _These results are really exciting! However, it's not totally obvious that your project will see similar gains. Performance is a tricky beast! If you do see significant speedups in your project, [leave a comment here on this issue](https://github.com/mdgriffith/elm-optimize-more/issues/15), we love to see realworld cases._
In an effort to quantify these transformations, we've put together a number of benchmarks, including some from exisiting Elm packages such as `dillonkearns/elm-markdown`, `w0rm/elm-obj-file`, and `mdgriffith/elm-ui`.
@ -108,11 +108,11 @@ _For this project, contributions always start with communication before code!_
That being said, there are a few areas that might be opportunities for contribution.
1. Try `elm-optimize` on any current Elm project you have!
1. Try `elm-optimize-more` on any current Elm project you have!
We'd love to hear your results whether they be success, no effect, or caused a regression.
If your project saw an explicit improvement or performance regression, [leave a comment on this issue](https://github.com/mdgriffith/elm-optimize/issues/15).
If your project saw an explicit improvement or performance regression, [leave a comment on this issue](https://github.com/mdgriffith/elm-optimize-more/issues/15).
For more serious issues, feel free to file a separate issue.

View File

@ -2,7 +2,7 @@
We're basically following the same protocol as [described on the Elm Guide.](https://guide.elm-lang.org/optimization/asset_size.html) We use Terser, which is just an actively maintained fork of Uglify.
After installing `elm-optimize`,
After installing `elm-optimize-more`,
Install a minifier like [`Terser`](https://www.npmjs.com/package/terser).
@ -13,7 +13,7 @@ npm install -g terser
Then, you'll want to run these commands to minify and gzip your code before deploying.
```bash
elm-optimize Main.elm --output=app.js
elm-optimize-more Main.elm --output=app.js
terser app.js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' | terser --mangle --output=app.min.js
gzip --keep --force app.min.js

View File

@ -1,6 +1,6 @@
# Overview of Transformations
This is an overview of the transformations for `elm-optimize`.
This is an overview of the transformations for `elm-optimize-more`.
Not all of them made the cut, but seeing that a transformation is not as effective as initially thought is really good information.
@ -51,7 +51,7 @@ MyFunction_fn(one two)
## Results Summary
- Included in `elm-optimize` tool\*\*
- Included in `elm-optimize-more` tool\*\*
- Potentially large positive effect on speed
- Likley small but positive effect on asset size
@ -177,7 +177,7 @@ There may be a nice trade off here of using `InlineMode.UsingConsFunc`, but only
## Results Summary
- Not included in the elm-optimize tool because it was hard to find a benchmark that reported numbers to justify it.
- Not included in the elm-optimize-more tool because it was hard to find a benchmark that reported numbers to justify it.
- Though maybe we just need to be better at benchmarking it
# Object Update
@ -258,7 +258,7 @@ Or we can use the spread operator inline:
## Result Summary
- Not included in elm-optimize tool
- Not included in elm-optimize-more tool
- Again, all of these tricks rely on either the spread operator or `Object.assign`, both of which are not supported in IE.
- The most promising approach was inlining the call completely with `{...old, field: newValue}`.
- Gave a `501%` boost in chrome!
@ -302,11 +302,11 @@ If Elm's `==` is applied to any primitive such as:
Then we can inline the definition directly as JS strict equality: `===`.
Right now `elm-optimize` will infer if something is a primitive if a literal is used.
Right now `elm-optimize-more` will infer if something is a primitive if a literal is used.
## Results Summary
- Included in `elm-optimize` tool.
- Included in `elm-optimize-more` tool.
- Looks to have the some impact on code that does a lot of equality comparisons, like parsing.
The `_Utils_eq` function is very likely deoptimized because it can take _any_ two values and either do a reference check, or do structural equality, which we also know takes a while.
@ -355,7 +355,7 @@ This is still a benefit because the minified code is what ultimately needs to be
## Results Summary
- Not included in the `elm-optimize` tool
- Not included in the `elm-optimize-more` tool
- Comes with the caveat that the [code will not work on IE](https://caniuse.com/#feat=arrow-functions)
We weren't able to pin down a benchmark where this reported a benefit in the numbers, though likely to explore this we need (1) A larger codebase, and (2)

View File

@ -11,7 +11,7 @@
"node": ">=10"
},
"bin": {
"elm-optimize": "./dist/index.js"
"elm-optimize-more": "./dist/index.js"
},
"scripts": {
"prepublish": "tsc -p tsconfig.json",