{"id":13688514,"url":"https://github.com/denosaurs/parry","last_synced_at":"2025-03-15T10:31:04.538Z","repository":{"id":62421459,"uuid":"223510209","full_name":"denosaurs/parry","owner":"denosaurs","description":"👷🏽‍♂️ Run deno functions in WebWorkers","archived":false,"fork":false,"pushed_at":"2023-03-26T17:28:13.000Z","size":56,"stargazers_count":19,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-13T17:52:18.059Z","etag":null,"topics":["deno","parallelization","typescript","webworker","webworkers","worker","workers"],"latest_commit_sha":null,"homepage":"https://deno.land/x/parry","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denosaurs.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":"2019-11-23T00:50:42.000Z","updated_at":"2024-03-08T17:38:35.000Z","dependencies_parsed_at":"2022-11-01T17:31:34.699Z","dependency_job_id":"c849d66a-4114-464a-a59d-4b764b1bb405","html_url":"https://github.com/denosaurs/parry","commit_stats":{"total_commits":42,"total_committers":2,"mean_commits":21.0,"dds":"0.023809523809523836","last_synced_commit":"fbc66b5a76ce2b5decac8ccefc1916aa8044098b"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denosaurs%2Fparry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denosaurs%2Fparry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denosaurs%2Fparry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denosaurs%2Fparry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denosaurs","download_url":"https://codeload.github.com/denosaurs/parry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242231984,"owners_count":20093748,"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":["deno","parallelization","typescript","webworker","webworkers","worker","workers"],"created_at":"2024-08-02T15:01:15.704Z","updated_at":"2025-03-15T10:31:04.515Z","avatar_url":"https://github.com/denosaurs.png","language":"TypeScript","readme":"# parry\n\n[![Tags](https://img.shields.io/github/release/denosaurs/parry)](https://github.com/denosaurs/parry/releases)\n[![CI Status](https://img.shields.io/github/workflow/status/denosaurs/parry/check)](https://github.com/denosaurs/parry/actions)\n[![Dependencies](https://img.shields.io/github/workflow/status/denosaurs/parry/depsbot?label=dependencies)](https://github.com/denosaurs/depsbot)\n[![License](https://img.shields.io/github/license/denosaurs/parry)](https://github.com/denosaurs/parry/blob/master/LICENSE)\n\n---\n\n\u003e ⚠️ This project is a working project. Expect breaking changes.\n\n---\n\nA simple way of running functions in their own Worker that works with\n[deno](https://deno.land/).\n\n## Usage\n\nThe following function will run in it's own Worker, enabling threading and\ntherefor not blocking the main event loop. This becomes very useful for\nparallelization of certain computations or just a way of running a function and\nnot blocking the main event loop while it runs. It is required to use the\n`--allow-read` flag for it to work due to an external js file being loaded in as\nthe worker. If you want the `Deno` object to be avalible in the worker the\n`--unstable` flag is required. Permissions inside the workers are inherited and\nimports need to be dynamic.\n\n```ts\nimport { parry } from \"https://deno.land/x/parry/mod.ts\";\n\nasync function countSerial(limit: number): Promise\u003cvoid\u003e {\n  for (let i = 0; i \u003c limit; i++) {}\n}\n\nconsole.time(\"4x CountSerial\");\nawait Promise.all([\n  countSerial(1e9),\n  countSerial(1e9),\n  countSerial(1e9),\n  countSerial(1e9),\n]);\nconsole.timeEnd(\"4x CountSerial\");\n\nconst threads = [\n  parry(countSerial),\n  parry(countSerial),\n  parry(countSerial),\n  parry(countSerial),\n];\n\nconsole.time(\"4x CountParallel\");\nawait Promise.all([\n  threads[0](1e9),\n  threads[1](1e9),\n  threads[2](1e9),\n  threads[3](1e9),\n]);\nconsole.timeEnd(\"4x CountParallel\");\n\nparry.close();\n```\n\nThe parallelized version is as expected 4x faster than the serial version of the\ncount function:\n\n```\n4x CountSerial: 1885ms\n4x CountParallel: 509ms\n```\n","funding_links":[],"categories":["deno"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenosaurs%2Fparry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenosaurs%2Fparry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenosaurs%2Fparry/lists"}