{"id":13850095,"url":"https://github.com/mdgriffith/elm-optimize-level-2","last_synced_at":"2025-10-25T08:06:25.626Z","repository":{"id":38425620,"uuid":"281112154","full_name":"mdgriffith/elm-optimize-level-2","owner":"mdgriffith","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-04T09:19:05.000Z","size":3874,"stargazers_count":134,"open_issues_count":39,"forks_count":17,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-10-24T02:24:55.274Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdgriffith.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-07-20T12:37:23.000Z","updated_at":"2025-08-20T13:53:11.000Z","dependencies_parsed_at":"2023-02-18T15:30:52.313Z","dependency_job_id":"374688dc-30e2-4363-a18e-0f16a407b6de","html_url":"https://github.com/mdgriffith/elm-optimize-level-2","commit_stats":{"total_commits":421,"total_committers":16,"mean_commits":26.3125,"dds":0.6294536817102138,"last_synced_commit":"46b0975d5349260d2492c2ee532af7230f5af407"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mdgriffith/elm-optimize-level-2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdgriffith%2Felm-optimize-level-2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdgriffith%2Felm-optimize-level-2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdgriffith%2Felm-optimize-level-2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdgriffith%2Felm-optimize-level-2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdgriffith","download_url":"https://codeload.github.com/mdgriffith/elm-optimize-level-2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdgriffith%2Felm-optimize-level-2/sbom","scorecard":{"id":633060,"data":{"date":"2025-08-11","repo":{"name":"github.com/mdgriffith/elm-optimize-level-2","commit":"46b0975d5349260d2492c2ee532af7230f5af407"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":4,"reason":"Found 10/22 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/mdgriffith/elm-optimize-level-2/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/mdgriffith/elm-optimize-level-2/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/mdgriffith/elm-optimize-level-2/test.yml/master?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"43 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-hm92-vgmw-qfmx","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-jg8v-48h5-wgxg","Warn: Project is vulnerable to: GHSA-36fh-84j7-cv5h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-pq67-2wwv-3xjx","Warn: Project is vulnerable to: GHSA-8cj5-5rvv-wf4v","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-wpg7-2c88-r8xv"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T08:25:22.462Z","repository_id":38425620,"created_at":"2025-08-21T08:25:22.462Z","updated_at":"2025-08-21T08:25:22.462Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280923455,"owners_count":26414237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T20:00:58.927Z","updated_at":"2025-10-25T08:06:25.577Z","avatar_url":"https://github.com/mdgriffith.png","language":"Elm","funding_links":[],"categories":["Elm"],"sub_categories":[],"readme":"# Elm Optimize, Level 2!\n\n_New to Elm? Check out the [Elm Guide's section on optimization](https://guide.elm-lang.org/optimization/). Elm already has a lot of optimization stuff built in, [like the `--optimize` flag](https://guide.elm-lang.org/optimization/asset_size.html)! Definitely check those out before using this project._\n\n**Beware, Experimental** - _This project is just starting and does have the power to break your Elm code in very un-Elm ways! While we currently believe every adjustment to the resulting javascript should be safe and make things explicitly faster, some of this code is subtle and it's hard to be 100% certain until we have a large number of projects using it successfully._\n\n_If you want to help out, try it out, **run your test suite** and let us know how it goes by leaving [a comment in this issue](https://github.com/mdgriffith/elm-optimize-level-2/issues/15)!_ :smiley:\n\nElm is fast.\n\nCan we make it faster?\n\n[Turns out, yes!](#Benchmarks) :rocket:\n\nElm Optimize, Level 2 is a project for exploring different optimizations that are specific to elm-generated javascript.\n\nThere are two parts to this.\n\n1. Explore different javascript representations for Elm code. This means gathering data on what a given representation would mean on realworld projects, and across browsers.\n\n2. A tool you can use _right now_ to compile elm using the adjustments that have given us the most speed!\n\n**Note** This work was given a massive headstart by [Robin Heggelund Hansen's article on areas where the Elm Compiler's output could be improved](https://dev.to/skinney/improving-elm-s-compiler-output-5e1h). Go read it! It's great.\n\n## Installation and Usage\n\n```\nnpm install -g elm-optimize-level-2\n```\n\nThen you can use `elm-optimize-level-2` just as you would `elm-make --optimize`.\n\n```\nelm-optimize-level-2 Main.elm\n```\n\nwill generate an `elm.js` file.\n\nThe first configurable option is what to name the generated js file.\n\n```\nelm-optimize-level-2 Main.elm --output app.js\n```\n\n**Note** — elm-optimize-level-2 only generates a js file, it doesn't support generating HTML.\n\n**Another Note** — Before deploying your app, you should also minify it and gzip it. `elm-optimize-level-2` does not do that for you. [Check out this doc for a recommended setup.](notes/minification.md)\n\n## The `--optimize-speed` flag\n\nYou can also provide `--optimize-speed` (`--O3`) to `elm-optimize-level-2`, which will attempt to generate even faster code at the expense of asset size.\n\nIf you enable this option you may experience a ~5% bigger js file, but with significantly faster record updates.\n\n\n## What's actually happening?\n\nThis might seem a bit like magic. :sparkles:\n\nIf you're interested in getting to know what's happening, [here's an overview of all the JS transformations we are exploring](notes/transformations.md)!\n\nNot all of them are included in the CLI tool because not all of them turned out to be beneficial. Part of this endeavor is a science project :bowtie:, where we capture data so we can know which transformations turn out to be worthwhile.\n\nA few are listed there as either incomplete or not attempted. That's future work!\n\n## Benchmarks\n\n**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-level-2/issues/15), we love to see realworld cases._\n\nIn 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`.\n\nOur goal is to have benchmarks that track performance on code where performance is meaningful.\n\n[Here's the most recent, comprehensive run of the benchmarks.](data/current.md)\n\nThough here are a few highlights:\n\n**Note** — keep in mind that these numbers have _all the caveats_ that benchmarks usually have. You may not see similar numbers depending on your machine, your browser, subtle differences in your code, etc.\n\n**Another Note** — From what we've seen, given that you're [minifying and gzipping your JS](notes/minification.md), these transformations should either have no effect on asset size, or may even make your app slightly smaller.\n\n## Html\n\n| Name                              | Transformations | Browser | Ops/Second | % Change |\n| --------------------------------- | --------------- | ------- | ---------- | -------- |\n| create a 4 level nested html tree |                 | safari  | 34,899     |          |\n| create a 4 level nested html tree | final           | safari  | 39,631     | (114%)   |\n| create a 4 level nested html tree |                 | firefox | 15,909     |          |\n| create a 4 level nested html tree | final           | firefox | 22,361     | (141%)   |\n| create a 4 level nested html tree |                 | chrome  | 28,959     |          |\n| create a 4 level nested html tree | final           | chrome  | 72,753     | (251%)   |\n\n## Elm Markdown\n\n| Name                      | Transformations | Browser | Ops/Second | % Change |\n| ------------------------- | --------------- | ------- | ---------- | -------- |\n| dillonkearns/elm-markdown |                 | safari  | 2,428      |          |\n| dillonkearns/elm-markdown | final           | safari  | 3,196      | (132%)   |\n| dillonkearns/elm-markdown |                 | firefox | 1,096      |          |\n| dillonkearns/elm-markdown | final           | firefox | 2,194      | (200%)   |\n| dillonkearns/elm-markdown |                 | chrome  | 2,489      |          |\n| dillonkearns/elm-markdown | final           | chrome  | 3,572      | (144%)   |\n\n## Running Benchmarks Locally\n\n1. Clone this repo\n2. Run `npm install`\n3. Run `npm run report` and a simple benchmark will hopefully run and print results to the terminal.\n\n**Note** you can control which benchmark runs with which transformation by adjusting `src/benchmarks/run.ts`.\n\n## Contributing\n\n_For this project, contributions always start with communication before code!_\n\nThat being said, there are a few areas that might be opportunities for contribution.\n\n1. Try `elm-optimize-level-2` on any current Elm project you have!\n\n   We'd love to hear your results whether they be success, no effect, or caused a regression.\n\n   If your project saw an explicit improvement or performance regression, [leave a comment on this issue](https://github.com/mdgriffith/elm-optimize-level-2/issues/15).\n\n   For more serious issues, feel free to file a separate issue.\n\n2. Are there more interesting benchmarks we could track?\n\n   We want the benchmarking suite to be as comprehensive as possible, though we have to weigh that against having a million benchmarks that essentially test the same thing.\n\n3. Know of an interesting transformation to try out?\n\n   Let us know! Either open an issue, or make a PR adding it to [notes/transformations.md](notes/transformations.md).\n\n4. Know of an article, paper, or project we might be interested in?\n\n   Let us know! We're keeping a list of relevant resources in [notes/resources.md](notes/resources.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdgriffith%2Felm-optimize-level-2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdgriffith%2Felm-optimize-level-2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdgriffith%2Felm-optimize-level-2/lists"}