{"id":13741731,"url":"https://github.com/AliChraghi/zort","last_synced_at":"2025-05-08T22:31:58.294Z","repository":{"id":40505005,"uuid":"426240508","full_name":"alichraghi/zort","owner":"alichraghi","description":"Sorting algorithms in zig","archived":false,"fork":false,"pushed_at":"2024-07-07T05:08:17.000Z","size":2606,"stargazers_count":70,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-02T22:44:08.222Z","etag":null,"topics":["sort","sorting","sorting-algorithms","sorting-algorithms-implemented","zig","zig-package"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/alichraghi.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-09T13:30:26.000Z","updated_at":"2025-04-19T10:51:10.000Z","dependencies_parsed_at":"2024-01-25T05:09:20.391Z","dependency_job_id":"252b1ed2-c887-419d-8ef7-7fd4486b21aa","html_url":"https://github.com/alichraghi/zort","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/alichraghi%2Fzort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alichraghi%2Fzort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alichraghi%2Fzort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alichraghi%2Fzort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alichraghi","download_url":"https://codeload.github.com/alichraghi/zort/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253157992,"owners_count":21863208,"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":["sort","sorting","sorting-algorithms","sorting-algorithms-implemented","zig","zig-package"],"created_at":"2024-08-03T04:01:02.165Z","updated_at":"2025-05-08T22:31:58.268Z","avatar_url":"https://github.com/alichraghi.png","language":"Zig","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# Zort\n\n![logo](/media/logo.png)\n\nImplementation of 13 sorting algorithms in Zig\n\n| Algorithm               | Custom Comparison | Zero Allocation |\n| ----------------------- | ----------------- | --------------- |\n| Bubble                  | ✅                | ✅              |\n| Comb                    | ✅                | ✅              |\n| Heap                    | ✅                | ✅              |\n| Insertion               | ✅                | ✅              |\n| Merge                   | ✅                | ❌              |\n| PDQ                     | ✅                | ✅              |\n| Quick                   | ✅                | ✅              |\n| Radix (no negative yet) | ❌                | ❌              |\n| Selection               | ✅                | ✅              |\n| Shell                   | ✅                | ✅              |\n| Tail                    | ✅                | ❌              |\n| Tim                     | ✅                | ❌              |\n| Twin                    | ✅                | ❌              |\n\n## Usage\n\n```zig\nconst zort = @import(\"zort\");\n\nfn asc(a: u8, b: u8) bool {\n    return a \u003c b;\n}\n\npub fn main() !void {\n    var arr = [_]u8{ 9, 1, 4, 12, 3, 4 };\n    try zort.quickSort(u8, \u0026arr, asc);\n}\n```\n\n## Benchmarks\n\nrun this to see results on your machine:\n```\nzig build bench -Doptimize=ReleaseFast -- comb quick radix shell std_block std_heap std_pdq tail tim twin\n```\n\n### 12th Gen Intel(R) Core(TM) i5-12400F\n\n```mermaid\ngantt\n    title Sorting (ascending) 10000000 usize\n    dateFormat x\n    axisFormat %S s\n    section random\n    quick 1.670: 0,1670\n    comb 3.156: 0,3155\n    shell 5.469: 0,5467\n    radix 0.304: 0,304\n    tim 2.893: 0,2893\n    tail 2.400: 0,2399\n    twin 2.377: 0,2377\n    std_block 3.371: 0,3372\n    std_pdq 2.250: 0,2250\n    std_heap 5.512: 0,5514\n    section sorted\n    quick 0.829: 0,829\n    comb 1.179: 0,1179\n    shell 0.740: 0,740\n    radix 0.301: 0,301\n    tim 0.025: 0,25\n    tail 0.058: 0,58\n    twin 0.071: 0,71\n    std_block 0.266: 0,266\n    std_pdq 0.041: 0,41\n    std_heap 3.912: 0,3913\n    section reverse\n    quick 1.544: 0,1544\n    comb 1.375: 0,1375\n    shell 1.378: 0,1378\n    radix 0.303: 0,303\n    tim 0.822: 0,822\n    tail 1.364: 0,1364\n    twin 1.280: 0,1280\n    std_block 1.304: 0,1304\n    std_pdq 0.199: 0,199\n    std_heap 3.844: 0,3845\n    section ascending saw\n    quick 2.979: 0,2978\n    comb 2.088: 0,2089\n    shell 1.807: 0,1807\n    radix 0.322: 0,322\n    tim 0.473: 0,473\n    tail 0.486: 0,486\n    twin 0.465: 0,465\n    std_block 1.129: 0,1129\n    std_pdq 1.604: 0,1604\n    std_heap 4.246: 0,4249\n    section descending saw\n    comb 1.949: 0,1949\n    shell 1.694: 0,1694\n    radix 0.299: 0,299\n    tim 1.339: 0,1339\n    tail 1.478: 0,1478\n    twin 1.288: 0,1288\n    std_block 1.618: 0,1618\n    std_pdq 1.613: 0,1613\n    std_heap 4.262: 0,4261\n```\n\n```mermaid\ngantt\n    title Sorting (ascending) 10000000 isize\n    dateFormat x\n    axisFormat %S s\n    section random\n    quick 1.691: 0,1691\n    comb 3.084: 0,3084\n    shell 5.410: 0,5413\n    radix 0.332: 0,332\n    tim 2.951: 0,2953\n    tail 2.414: 0,2414\n    twin 2.414: 0,2414\n    std_block 3.346: 0,3346\n    std_pdq 2.309: 0,2309\n    std_heap 5.449: 0,5447\n    section sorted\n    quick 0.798: 0,798\n    comb 1.166: 0,1166\n    shell 0.739: 0,739\n    radix 0.247: 0,247\n    tim 0.025: 0,25\n    tail 0.059: 0,59\n    twin 0.048: 0,48\n    std_block 0.270: 0,270\n    std_pdq 0.039: 0,39\n    std_heap 3.816: 0,3815\n    section reverse\n    quick 1.581: 0,1581\n    comb 1.347: 0,1347\n    shell 1.234: 0,1234\n    radix 0.262: 0,262\n    tim 0.044: 0,44\n    tail 1.396: 0,1396\n    twin 0.041: 0,41\n    std_block 0.953: 0,953\n    std_pdq 0.204: 0,204\n    std_heap 3.713: 0,3713\n    section ascending saw\n    quick 5.516: 0,5516\n    comb 2.064: 0,2064\n    shell 1.632: 0,1632\n    radix 0.280: 0,280\n    tim 0.449: 0,449\n    tail 0.466: 0,466\n    twin 0.478: 0,478\n    std_block 1.157: 0,1157\n    std_pdq 1.618: 0,1618\n    std_heap 4.281: 0,4279\n    section descending saw\n    comb 2.039: 0,2040\n    shell 1.644: 0,1644\n    radix 0.279: 0,279\n    tim 0.465: 0,465\n    tail 1.492: 0,1492\n    twin 0.481: 0,481\n    std_block 1.596: 0,1596\n    std_pdq 1.576: 0,1576\n    std_heap 4.199: 0,4199\n```\n\n### Big Thank to\n\n[voroskoi](https://github.com/voroskoi) and other contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAliChraghi%2Fzort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAliChraghi%2Fzort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAliChraghi%2Fzort/lists"}