{"id":20594356,"url":"https://github.com/ramonmeza/python_vs_c_vs_zig","last_synced_at":"2026-04-13T12:31:04.348Z","repository":{"id":263061269,"uuid":"889232342","full_name":"ramonmeza/python_vs_c_vs_zig","owner":"ramonmeza","description":"A performance comparison of different algorithms implemented in Python, C, and Zig.","archived":false,"fork":false,"pushed_at":"2024-11-17T18:07:26.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T10:43:34.451Z","etag":null,"topics":["algorithms","c","python","quicksort","sorting","zig","zig-program"],"latest_commit_sha":null,"homepage":"","language":"Python","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/ramonmeza.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-11-15T21:42:03.000Z","updated_at":"2025-02-08T14:10:55.000Z","dependencies_parsed_at":"2024-11-15T22:31:28.278Z","dependency_job_id":"4f8d34a7-9269-418b-aed6-35d29787c374","html_url":"https://github.com/ramonmeza/python_vs_c_vs_zig","commit_stats":null,"previous_names":["ramonmeza/python_vs_c_vs_zig"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ramonmeza/python_vs_c_vs_zig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramonmeza%2Fpython_vs_c_vs_zig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramonmeza%2Fpython_vs_c_vs_zig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramonmeza%2Fpython_vs_c_vs_zig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramonmeza%2Fpython_vs_c_vs_zig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ramonmeza","download_url":"https://codeload.github.com/ramonmeza/python_vs_c_vs_zig/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramonmeza%2Fpython_vs_c_vs_zig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31752992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["algorithms","c","python","quicksort","sorting","zig","zig-program"],"created_at":"2024-11-16T08:08:43.935Z","updated_at":"2026-04-13T12:31:04.325Z","avatar_url":"https://github.com/ramonmeza.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Algorithm Performance Showdown\n\nA performance comparison test on different algorithms implemented in Python, C,\nand Zig.\n\n## `app.py`\n\n[Source File](app.py)\n\nThis application takes in the CLI arguments, creates a `TestReport`, creates\nrandomized test data and passes that data to the algorithm. The `TestReport` is\nthen saved, which saves data related to the tests in JSON format into a `reports`\nsubdirectory.\n\n### CLI Usage\n\n```sh\nusage: app.py [-h] [--num-iterations NUM_ITERATIONS] [--num-elements NUM_ELEMENTS] [--algorithm {c_quicksort,py_quicksort,zig_quicksort}]\n\noptions:\n  -h, --help            show this help message and exit\n  --num-iterations, -n NUM_ITERATIONS\n                        Number of iterations to run for each algorithm.\n  --num-elements, -e NUM_ELEMENTS\n                        Number of elements in the test data used as input for each algorithm.\n  --algorithm, -a {c_quicksort,py_quicksort,zig_quicksort}\n                        The algorithm to test.\n```\n\n## `build.zig`\n\nYou will need to build the C libraries and Zig libraries using `zig build`. For\nmore advanced usage, utilize the CLI arguments.\n\n### CLI Usage\n\n```sh\nUsage: zig build [steps] [options]\n\nSteps:\n  install (default)            Copy build artifacts to prefix path\n  uninstall                    Remove build artifacts from prefix path\n  c_quicksort                  Build the c_quicksort shared library.\n  zig_quicksort                Build the zig_quicksort shared library.\n  all                          Build all libraries.\n```\n\n## Sorting Algorithms\n\n### Quicksort\n\n| Argument         | Value |\n| ---------------- | ----- |\n| `num_iterations` | 100   |\n| `num_elements`   | 1000  |\n\n#### `PythonImpl` Results\n\n[Source File](src/quicksort.py)\n\n```json\n{\n  \"algorithm\": \"py_quicksort\",\n  \"num_iterations\": 100,\n  \"num_elements\": 1000,\n  \"total_elapsed_time\": 0.09324749999359483,\n  \"average\": 0.0009324749999359483,\n  \"minimum\": 0.0007798000006005168,\n  \"maximum\": 0.0015515000050072558\n}\n```\n\n#### `CImpl` Results\n\n[Source File](src/quicksort.c)\n\n```json\n{\n  \"algorithm\": \"c_quicksort\",\n  \"num_iterations\": 100,\n  \"num_elements\": 1000,\n  \"total_elapsed_time\": 0.01527510002051713,\n  \"average\": 0.0001527510002051713,\n  \"minimum\": 0.00012479999713832512,\n  \"maximum\": 0.00027260000206297264\n}\n```\n\n#### `ZigImpl` Results\n\n[Source File](src/quicksort.zig)\n\n```json\n{\n  \"algorithm\": \"zig_quicksort\",\n  \"num_iterations\": 100,\n  \"num_elements\": 1000,\n  \"total_elapsed_time\": 0.013725400021940004,\n  \"average\": 0.00013725400021940003,\n  \"minimum\": 0.00012479999713832512,\n  \"maximum\": 0.00026839999918593094\n}\n```\n\n## Join the Conversation\n\nIf you have comments or suggestions, or just want to lurk around the thread for\nthis repo, check it out on [Ziggit](https://ziggit.dev/t/comparing-python-zig-and-c/6883).\n\nhttps://ziggit.dev/t/comparing-python-zig-and-c/6883\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framonmeza%2Fpython_vs_c_vs_zig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framonmeza%2Fpython_vs_c_vs_zig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framonmeza%2Fpython_vs_c_vs_zig/lists"}