{"id":15538233,"url":"https://github.com/ali77gh/language_performance_prime_algorithm","last_synced_at":"2025-08-18T17:33:46.706Z","repository":{"id":157109013,"uuid":"628523891","full_name":"ali77gh/language_performance_prime_algorithm","owner":"ali77gh","description":"implementing is_prime function and test speed of execution in different languages and runtimes.","archived":false,"fork":false,"pushed_at":"2024-06-12T09:56:13.000Z","size":71,"stargazers_count":38,"open_issues_count":1,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-09T12:09:31.594Z","etag":null,"topics":["benchmark","prime-numbers","programming-language"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/ali77gh.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-04-16T08:03:13.000Z","updated_at":"2024-06-14T16:53:16.000Z","dependencies_parsed_at":"2024-10-31T18:05:03.305Z","dependency_job_id":"66c7bcda-164c-40bf-ae46-9f2d014621ac","html_url":"https://github.com/ali77gh/language_performance_prime_algorithm","commit_stats":{"total_commits":72,"total_committers":15,"mean_commits":4.8,"dds":0.4444444444444444,"last_synced_commit":"0ff39b7013bada6825a0e889c779e3c2fabb25bf"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali77gh%2Flanguage_performance_prime_algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali77gh%2Flanguage_performance_prime_algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali77gh%2Flanguage_performance_prime_algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali77gh%2Flanguage_performance_prime_algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ali77gh","download_url":"https://codeload.github.com/ali77gh/language_performance_prime_algorithm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230260702,"owners_count":18198537,"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":["benchmark","prime-numbers","programming-language"],"created_at":"2024-10-02T12:02:42.451Z","updated_at":"2024-12-18T11:06:53.351Z","avatar_url":"https://github.com/ali77gh.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Performance Test\n\nThis repository contains an implementation of the `is_prime` function in multiple programming languages using the same algorithm. The goal is to compare the performance of different languages and runtimes.\n\n## Usage\n\nTo run code in various programming languages, use the `run.sh` script:\n\n```bash\n./run.sh [LANGUAGE]\n```\n\nIf no argument is provided, the script will run code in all supported languages. Otherwise, provide a language name to run the corresponding code.\n\n### Supported Languages\n\n- assembly\n- c\n- cpp\n- rust\n- go\n- java\n- nodejs\n- csharp_mono\n- dart\n- python_codon\n- pascal\n- python\n- php\n- r\n- [chap](https://github.com/ali77gh/Chap)\n- lua\n\n### Examples\n\n```bash\n# Run code in all supported languages\n./run.sh\n\n# Run specific language\n./run.sh cpp\n```\n\nTo display usage instructions and a list of supported languages, use the `--help` or `-h` flag:\n\n```bash\n./run.sh --help\n```\n\nIf you want to add your own test results, simply run the `run.sh` script with your CPU model name and redirect the output to a file in the `result` directory.\n\nSee the [result directory](./result) for the output of running the tests on different CPUs.\n\n## My Laptop (Intel(R) Core(TM) i7-8550U)\n\nNote: times are 5% more or less on different runs, so C and C++ can win sometimes.\n\n| Ranking | Language | Runtime/Compiler | Time   | n% Slower than Winner |\n| ------- | -------- | ---------------- | ------ | --------------------- |\n| #1      | Assembly | NASM             | 3.10s  | Winner                |\n| #2      | C        | GCC              | 3.12s  | 0.64%                 |\n| #3      | C++      | G++              | 3.15s  | 1.6%                  |\n| #4      | Java     | OpenJDK 17       | 3.62s  | 16%                   |\n| #5      | Go       | Go 1.20.3        | 3.81s  | 22%                   |\n| #6      | Julia    | Julia 1.8.5      | 3.87s  | 24%                   |\n| #7      | Rust     | Native 1.67.1    | 3.97s  | 28%                   |\n| #8      | C#       | Mono 6.8         | 5.32s  | 71%                   |\n| #9      | Js       | Nodejs 20        | 5.80s  | 87%                   |\n| #10     | Dart     | Dart 2.19.0      | 7.11s  | 129%                  |\n| #11     | Python   | Codon 0.16.0     | 10.89s | 251%                  |\n| #12     | Pascal   | FPC 3.2.2        | 13.68s | 341%                  |\n| #13     | PHP      | PHP 8.2.5        | 26.32s | 749%                  |\n| #14     | Lua      | Lua 5.2.4        | 34.00s | 996%                  |\n| #15     | Python   | Python 3.11.3    | 82.31s | 2545%                 |\n| #16     | Ruby     | Ruby 3.2.2       | 85.55s | 2641%                 |\n| #17     | R        | Rscript 4.0.4    | 240.0s | 7641%                 |\n| #18     | [Chap](https://github.com/ali77gh/Chap)     | Chap 2.2.2       | 602s  | 19319%                |\n\nThe `n% Slower than Winner` column shows the percent difference between the time taken by each language and the fastest language (Assembly).\n\nFormula: ((LanguageTime - WinnerTime) * 100) / WinnerTime\n\n## Contribute\n\nYou can contribute to this repository in one of the following ways:\n\n1. Optimize your favorite programming language **without changing the algorithm** and without using concurrency.\n2. Add a new language by using **the same algorithm**.\n3. Add a new runtime.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fali77gh%2Flanguage_performance_prime_algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fali77gh%2Flanguage_performance_prime_algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fali77gh%2Flanguage_performance_prime_algorithm/lists"}