{"id":16829088,"url":"https://github.com/kvanttt/antlrbenchmarks","last_synced_at":"2025-07-29T19:10:44.629Z","repository":{"id":148831031,"uuid":"278063598","full_name":"KvanTTT/AntlrBenchmarks","owner":"KvanTTT","description":"Collection of benchmarks that reveal the performance of some lexing and parsing issues (mostly C# runtime)","archived":false,"fork":false,"pushed_at":"2022-05-07T19:59:57.000Z","size":4972,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T04:03:08.295Z","etag":null,"topics":["antlr","antlr4","benchmark","dotnet","grammar"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/KvanTTT.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":"2020-07-08T10:49:35.000Z","updated_at":"2024-10-20T14:58:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"dbd8741f-4e0d-4ee5-b8f4-1b326baa10c4","html_url":"https://github.com/KvanTTT/AntlrBenchmarks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KvanTTT/AntlrBenchmarks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KvanTTT%2FAntlrBenchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KvanTTT%2FAntlrBenchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KvanTTT%2FAntlrBenchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KvanTTT%2FAntlrBenchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KvanTTT","download_url":"https://codeload.github.com/KvanTTT/AntlrBenchmarks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KvanTTT%2FAntlrBenchmarks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267739598,"owners_count":24136964,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["antlr","antlr4","benchmark","dotnet","grammar"],"created_at":"2024-10-13T11:30:15.472Z","updated_at":"2025-07-29T19:10:44.548Z","avatar_url":"https://github.com/KvanTTT.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ANTLR Benchmarks\n\nThe repository contains benchmarks of different grammars over different runtimes:\n\n* Java Standard\n* [Java Optimized](https://github.com/tunnelvisionlabs/antlr4)\n* C# Standard\n* [C# Optimized](https://github.com/tunnelvisionlabs/antlr4cs)\n* Python 3\n* JavaScript (nodejs)\n* Go\n* Php\n\nThe integration of other runtimes (C++, Swift) is under development.\n\n## How to run\n\nJust run the script `./benchmark.ps1` in `Benchmark` directory\n\n## Requirements\n\n* Powershell\n* Installed runtimes that you want to benchmark (.NET Core, Java, Python 3, NodeJS, Go, Php)\n* Installed antlr4 runtimes on the runtimes\n\n## Method of benchmarking\n\nThe following libraries are used for benchmarking:\n\n* Java: [JMH](https://openjdk.java.net/projects/code-tools/jmh/)\n* C#: [BenchmarkDotNet](https://benchmarkdotnet.org/)\n* Php: [phpbench](https://github.com/phpbench/phpbench)\n* Python: [timeit function](https://docs.python.org/3/library/timeit.html)\n* JavaScript, Go: manual measurement using warmup and many iterations\n\n## Results\n\nHere is an example of NotLeft vs Left Recursion comparison. The main parameter\nis `Ratio`, the `Mean` parameter can be different from machine to machine.\n\n### Not Left Recursion\n\n| Runtime                                 |  Mean [ns] |      Ratio |\n| ---                                     |        --- |        --- |\n| JavaStandard_NotLeftRecursion           |     150702 |       1,00 |\n| JavaOptimized_NotLeftRecursion          |     147858 |       0,98 |\n| CSharpOptimized_NotLeftRecursion        |     322393 |       2,14 |\n| Python3Standard_NotLeftRecursion        |   31555147 |     209,39 |\n| JavaScriptStandard_NotLeftRecursion     |     594170 |       3,94 |\n| GoStandard_NotLeftRecursion             |     789169 |       5,24 |\n| PhpStandard_NotLeftRecursion            |  166762375 |    1106,57 |\n\n### Left Recursion\n\n| Runtime                                 |  Mean [ns] |      Ratio |\n| ---                                     |        --- |        --- |\n| JavaStandard_LeftRecursion              |     173714 |       1,15 |\n| JavaOptimized_LeftRecursion             |     415581 |       2,76 |\n| CSharpOptimized_LeftRecursion           |    1302527 |       8,64 |\n| Python3Standard_LeftRecursion           |   41263081 |     273,81 |\n| JavaScriptStandard_LeftRecursion        |     618468 |       4,10 |\n| GoStandard_LeftRecursion                |    1023692 |       6,79 |\n| PhpStandard_LeftRecursion               |  258153250 |    1713,00 |\n\nAs we see NotLeftRecursion grammar is faster than LeftRecursion one on ~15% in\nthe worst case.\n\nJava runtime is the fastest and PHP runtime is the slowest:\nmore than 1000 times slower than Java.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvanttt%2Fantlrbenchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkvanttt%2Fantlrbenchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvanttt%2Fantlrbenchmarks/lists"}