{"id":13711079,"url":"https://github.com/katafrakt/zig-ruby","last_synced_at":"2025-07-11T21:30:31.145Z","repository":{"id":84614054,"uuid":"580603971","full_name":"katafrakt/zig-ruby","owner":"katafrakt","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-24T20:36:30.000Z","size":7,"stargazers_count":68,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T08:51:13.334Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Zig","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/katafrakt.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":"2022-12-21T01:07:29.000Z","updated_at":"2024-11-07T19:17:39.000Z","dependencies_parsed_at":"2023-03-01T18:15:18.012Z","dependency_job_id":"3196a241-a885-46d4-9fa0-4b8d2452d27c","html_url":"https://github.com/katafrakt/zig-ruby","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/katafrakt/zig-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katafrakt%2Fzig-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katafrakt%2Fzig-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katafrakt%2Fzig-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katafrakt%2Fzig-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katafrakt","download_url":"https://codeload.github.com/katafrakt/zig-ruby/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katafrakt%2Fzig-ruby/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264901938,"owners_count":23680957,"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-02T23:01:04.227Z","updated_at":"2025-07-11T21:30:30.819Z","avatar_url":"https://github.com/katafrakt.png","language":"Zig","readme":"## What's this?\n\nThis repo contains an experiment of building a Ruby extension with Zig programming language.\nIt implements a slightly altered version of [100 doors](https://rosettacode.org/wiki/100_doors) from Rosetta Code.\n\nThese are results of benchmarks on my machine (Thinkpad T14):\n\n```\nWarming up --------------------------------------\n                Ruby   924.000  i/100ms\n                 Zig    13.885k i/100ms\nCalculating -------------------------------------\n                Ruby     12.745k (±22.1%) i/s -     60.984k in   5.052486s\n                 Zig    233.096k (± 0.1%) i/s -      1.166M in   5.003698s\n\nComparison:\n                 Zig:   233095.9 i/s\n                Ruby:    12744.7 i/s - 18.29x  (± 0.00) slower\n```\n\nHowever, if you edit `extconf.rb` to use `-Drelease-fast` flag, the difference is much bigger:\n\n```\nWarming up --------------------------------------\n                Ruby     1.020k i/100ms\n                 Zig   171.828k i/100ms\nCalculating -------------------------------------\n                Ruby     10.289k (± 2.2%) i/s -     52.020k in   5.058112s\n                 Zig      2.833M (± 6.3%) i/s -     14.262M in   5.059011s\n\nComparison:\n                 Zig:  2833045.1 i/s\n                Ruby:    10289.0 i/s - 275.35x  (± 0.00) slower\n```\n\nPlease note that this is only one benchmark, not much science behind it. It doesn't mean you will always get\n270x speed boost on just rewriting in Zig.\n\n## How to run it\n\n1. You need fairly recent version of Zig, which at this time means a version built from git\n2. Clone this repo\n3. Run `rake benchmark`\n\nNote that it likely only works on Linux, I'd gladly \n","funding_links":[],"categories":["Interoperability"],"sub_categories":["FFI Bindings"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatafrakt%2Fzig-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatafrakt%2Fzig-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatafrakt%2Fzig-ruby/lists"}