{"id":13725039,"url":"https://github.com/bobzhang/zero-cost-rescript","last_synced_at":"2025-03-21T20:33:13.091Z","repository":{"id":54405484,"uuid":"336998676","full_name":"bobzhang/zero-cost-rescript","owner":"bobzhang","description":"A demo project showing close to zero cost when adopting ReScript since version 9","archived":false,"fork":false,"pushed_at":"2021-02-20T11:10:30.000Z","size":189,"stargazers_count":40,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T04:51:54.731Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bobzhang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-08T07:52:13.000Z","updated_at":"2024-11-04T23:55:38.000Z","dependencies_parsed_at":"2022-08-13T14:40:32.076Z","dependency_job_id":null,"html_url":"https://github.com/bobzhang/zero-cost-rescript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobzhang%2Fzero-cost-rescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobzhang%2Fzero-cost-rescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobzhang%2Fzero-cost-rescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobzhang%2Fzero-cost-rescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bobzhang","download_url":"https://codeload.github.com/bobzhang/zero-cost-rescript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244866209,"owners_count":20523479,"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","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-03T01:02:10.642Z","updated_at":"2025-03-21T20:33:12.760Z","avatar_url":"https://github.com/bobzhang.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\n# Zero bundle cost for [ReScript](https://github.com/rescript-lang/rescript-compiler)\n\nThis is a repo showing that when adopting ReScript in your projects, it adds close to zero cost to your bundler size unlike many other languages compiled to JS platform.\n\nWe have serveral modules:  `listLength`, `listForEachU`, `listForEach`, `App`, `AppOptimized`.\n\nFor each `module`, `module.mjs` is the generated js code using Ecmascript module format, \n\n`module.bundle.js` is the bundled output using a bundler -- it is a self contained script that runs with all dependencies bundled in.\n\n\nFor [listLength](./src/listLength.bundle.js), and [listForEachU](./src/listForEachU.bundle.js)  the bundled code is tiny (a couple of hundered bytes including comments).\n\n[listForEach](./src/listForEach.bundle.js) is slightly larger since it needs curried runtime support, but its output is still tiny.\n\n[App.res](./src/App.res) is a working example using Rescript with React. You can see the bundled output: [App.bundle.js](./src/App.bundle.js) by grepping `bs-platform`, only lines from 5536-5594 -- less than 60 lines of code -- are needed for ReScript runtime.\n\nEven for such 60 lines of code, it can be optmized away using uncurried calling convention in [AppOptimized.res](./src/AppOptimized.res). In the [AppOptimized.bundle.js](./src/AppOptimized.bundle.js), the ReScript app using React is completely ReScript runtime free.\n\nNote the bundler is configured to not rename variables so that we can have a clear look at the impact of using ReScript.\n\n# Build\n```\nnpm run build\n```\n# Bundle\n\nThe bundle demo uses the open source bundler esbuild\n```\nnode ./bundle.js\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobzhang%2Fzero-cost-rescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobzhang%2Fzero-cost-rescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobzhang%2Fzero-cost-rescript/lists"}