{"id":20252638,"url":"https://github.com/streamdal/wasm-pre-init","last_synced_at":"2026-03-19T14:55:29.589Z","repository":{"id":243718531,"uuid":"812806264","full_name":"streamdal/wasm-pre-init","owner":"streamdal","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-10T18:27:07.000Z","size":474,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-06T02:36:45.500Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Makefile","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/streamdal.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-09T23:28:51.000Z","updated_at":"2024-06-10T18:27:11.000Z","dependencies_parsed_at":"2024-06-10T21:29:49.060Z","dependency_job_id":"24c816b6-e080-4d6a-8171-3dd4174ae871","html_url":"https://github.com/streamdal/wasm-pre-init","commit_stats":null,"previous_names":["streamdal/wasm-pre-init"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/streamdal/wasm-pre-init","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamdal%2Fwasm-pre-init","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamdal%2Fwasm-pre-init/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamdal%2Fwasm-pre-init/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamdal%2Fwasm-pre-init/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamdal","download_url":"https://codeload.github.com/streamdal/wasm-pre-init/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamdal%2Fwasm-pre-init/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29510523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-11-14T10:17:42.629Z","updated_at":"2026-02-16T15:02:59.902Z","avatar_url":"https://github.com/streamdal.png","language":"Makefile","readme":"# wasm-pre-init\n\nQuick and dirty testing [wizer](https://github.com/bytecodealliance/wizer) \nagainst wasm binaries built with rust and ran using [wazero](https://github.com/tetratelabs/wazero/) runtime.\n\nSpoiler: it works perfectly :)\n\n## Explanation\n`wizer` is a pre-initializer for Wasm - think `wasm-opt`. \n\nThis would allow you to do something resource intensive at build time, rather\nthan runtime. For example, you could pre-initialize multiple regexes that are\nnormally quite expensive.\n\n## This Test\n\nThis test verifies that `wizer` works with wasm artifacts produced by `wazero`.\n\nThere are two test cases:\n\n**`wasm-regex` and `wasm-sleep`**\n\n### wasm-regex\n\nThis test case has two wasm files - `wasm-regex-regular.wasm` and `wasm-regex-init.wizer.wasm`.\n\n* `*regular*` contains regex init code directly in the `_start()` func.\n* `*init.wizer*` contains regex init code in the `init()` func.\n\n`make run` will show how long `wazero run ...` took to run both of the wasm files.\n\n`time` isn't precise enough to give a definitive answer as to what's faster, so\nneed another more test that gives us a clearer picture.\n\n### wasm-sleep\n\nIn this case, `*regular.wasm` will sleep for 5s before printing \"John Doe\". \n`*init.wizer.wasm` will sleep for 5s in the `init()` func and print \"John Doe\"\nin the `_start()` func.\n\nSame as with `wasm-regex`:\n\n* `*regular*` contains sleep code directly in the `_start()` func.\n* `*init.wizer*` contains sleep code in the `init()` func.\n\nYou should see that `*init.wizer.wasm` will take \u003c1s to run while `*regular.wasm` will take \u003e5s.\n\n## Result\n```bash\n~/Code/streamdal/wasm-pre-init master*                                                                                                                                                 ◒\n❯ make run\nTesting wasm-regex-regular...\ntime wazero run -env NUM=123 build/wasm_regex_regular.wasm\nMatched!\n        3.52 real         3.49 user         0.03 sys\nTesting wasm-regex-init...\ntime wazero run -env NUM=123 build/wasm_regex_init.wizer.wasm\nMatched!\n        3.48 real         3.46 user         0.02 sys\nTesting wasm-sleep-regular...\ntime wazero run build/wasm_sleep_regular.wasm\nName: John Doe\n        5.07 real         0.06 user         0.01 sys\nTesting wasm-sleep-init...\ntime wazero run build/wasm_sleep_init.wizer.wasm\nName: John Doe\n        0.07 real         0.06 user         0.01 sys\n```\n\n\n## Setup\n1. Install `wazero` CLI binary; install `wizer` via cargo.\n1. Run `make build` \u003c- this will create .wasm artifacts in `./build/*`\n1. Run `make run` \u003c- this will perform `time wazero run ...` on each one of the wasm files in the `./build` dir.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamdal%2Fwasm-pre-init","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamdal%2Fwasm-pre-init","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamdal%2Fwasm-pre-init/lists"}