Coder Social home page Coder Social logo

kvanttt / antlrbenchmarks Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 2.0 4.86 MB

Collection of benchmarks that reveal the performance of some lexing and parsing issues (mostly C# runtime)

License: MIT License

C# 22.35% ANTLR 1.26% Java 9.81% Python 22.88% JavaScript 25.52% Go 14.58% PowerShell 3.21% PHP 0.40%
benchmark antlr4 grammar antlr dotnet

antlrbenchmarks's Introduction

ANTLR Benchmarks

The repository contains benchmarks of different grammars over different runtimes:

The integration of other runtimes (C++, Swift) is under development.

How to run

Just run the script ./benchmark.ps1 in Benchmark directory

Requirements

  • Powershell
  • Installed runtimes that you want to benchmark (.NET Core, Java, Python 3, NodeJS, Go, Php)
  • Installed antlr4 runtimes on the runtimes

Method of benchmarking

The following libraries are used for benchmarking:

Results

Here is an example of NotLeft vs Left Recursion comparison. The main parameter is Ratio, the Mean parameter can be different from machine to machine.

Not Left Recursion

Runtime Mean [ns] Ratio
JavaStandard_NotLeftRecursion 150702 1,00
JavaOptimized_NotLeftRecursion 147858 0,98
CSharpOptimized_NotLeftRecursion 322393 2,14
Python3Standard_NotLeftRecursion 31555147 209,39
JavaScriptStandard_NotLeftRecursion 594170 3,94
GoStandard_NotLeftRecursion 789169 5,24
PhpStandard_NotLeftRecursion 166762375 1106,57

Left Recursion

Runtime Mean [ns] Ratio
JavaStandard_LeftRecursion 173714 1,15
JavaOptimized_LeftRecursion 415581 2,76
CSharpOptimized_LeftRecursion 1302527 8,64
Python3Standard_LeftRecursion 41263081 273,81
JavaScriptStandard_LeftRecursion 618468 4,10
GoStandard_LeftRecursion 1023692 6,79
PhpStandard_LeftRecursion 258153250 1713,00

As we see NotLeftRecursion grammar is faster than LeftRecursion one on ~15% in the worst case.

Java runtime is the fastest and PHP runtime is the slowest: more than 1000 times slower than Java.

antlrbenchmarks's People

Contributors

kvanttt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.