{"id":13712708,"url":"https://github.com/CoalNova/BasicCompare","last_synced_at":"2025-05-06T22:31:24.179Z","repository":{"id":166905000,"uuid":"642454570","full_name":"CoalNova/BasicCompare","owner":"CoalNova","description":"A basic comparitive analysis of C, C++, Rust, and Zig.","archived":false,"fork":false,"pushed_at":"2023-05-23T15:16:23.000Z","size":45,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-26T14:54:05.808Z","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CoalNova.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":"2023-05-18T15:48:26.000Z","updated_at":"2024-10-31T08:43:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"7acf50e8-54c0-484c-ae05-35745555160f","html_url":"https://github.com/CoalNova/BasicCompare","commit_stats":null,"previous_names":["coalnova/basiccompare"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoalNova%2FBasicCompare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoalNova%2FBasicCompare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoalNova%2FBasicCompare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoalNova%2FBasicCompare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CoalNova","download_url":"https://codeload.github.com/CoalNova/BasicCompare/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252779065,"owners_count":21802874,"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:21.693Z","updated_at":"2025-05-06T22:31:24.150Z","avatar_url":"https://github.com/CoalNova.png","language":"Zig","readme":"# BasicCompare\n![pretty command line text](https://github.com/CoalNova/BasicCompare/blob/main/ast/sc.png?raw=true)\nA basic comparitive analysis of C, C++, Rust, Zig, Python, and Java.\n---\n\n\n\n### Overview\n\nThe goal of this project was to test operational time performance for each language using as like operations as possible. Though per-lang optimizations could be performed, the systems-level languages allow for inline assembly. That means this would get real nasty, real quick. The implementation is meant to be a naive, or at least a beginner's basic approach to the problem.\n\nThe operations are:\n - using a struct to contain a billable user account\n - propogated by a language provided random number generator\n - over a provided (100 default) number of iterations\n - propagate a resizeable heap-based account collection of provided operation size (100 default)\n - iterate over the list and perform a billing based on account balance (actual values don't matter)\n - perform the iteration loop operation number of times\n - clear list/free memory\n\nAlthough variations obviously change between languages, those operations are performed in much the same manner across. The languages are compiled using optimizations where available. C/C++ uses -O2, Rust uses --release, and Zig uses ReleaseFast. Programs will print to command line the total time of execution. As well as the maximum, minimum, and average per-iteration times.\n\n---\n### Useage\n\n\nThe provided Makefile should build on any machine that has Make/Clang, Rust/Cargo, Zig, and Java. Python .py file to be run via CLI `$ python ./python/main.py`. Each program allows for up to two numeric arguments, with the first assigning operations, and the second iterations.\n\n---\n### Timings\n\nRaw output on an admittedly cheap laptop running 100 operations over 1000 iterations are as follows:\n\n| Language | Execution Time (s) | Max (ns) | Min (ns) | Avg (ns) | C Ratio |\n|-|-|-|-|-|-|\n| C | 0.335615 | 455000 | 296000 | 335181 | 1.00 |\n| C++ | 0.348636 | 477918 | 306957 | 348245 | 0.96 |\n| Rust | 0.229681174 | 368683 | 201749 | 229564 | 1.46 |\n| Zig | 0.10153 | 541197 | 75332 | 95047 | 3.30 |\n| Python | 14.77727734 | 33754451 | 12984472 | 14775610 | 0.02 |\n| Java | 0.263353044 | 7772037 | 130966 | 240370 | 1.27 |\n\n\\**note: Python timed via interpreter, your times may vary. Please speak to your doctor or a licensed medical professional before attempting Java. Not to be confused with financial advice. Offer void in Utah.*\n","funding_links":[],"categories":["Performance Benchmark","Fundamentals"],"sub_categories":["Performance Benchmark"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCoalNova%2FBasicCompare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCoalNova%2FBasicCompare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCoalNova%2FBasicCompare/lists"}