Coder Social home page Coder Social logo

shalunov / catalan-benchmark Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 20 KB

Catalan numbers language benchmark

C 10.38% Julia 6.56% JavaScript 5.84% Perl 5.23% Python 13.98% Ruby 4.68% Kotlin 5.73% Swift 6.49% Rust 8.43% Go 8.50% Shell 5.66% Java 9.40% C# 9.10%
benchmark c julialang javascript perl python ruby golang rust kotlin swift

catalan-benchmark's Introduction

Catalan numbers benchmark

All the programs take an argument n and print all the combinations of n balanced pairs of parentheses, one expression per line. This benchmark is heavy on recursion and string manipulation.

These were run on an otherwise quiescent MacBook Pro with 2.3 GHz Intel Core i7, while redirecting output to /dev/null, under time, with an argument of 15.

The results are:

  • C (clang -O3) — 0.651s
  • Go — 2.060s
  • PyPy — 3.980s
  • Julia 0.6 — 4.516s
  • JRuby — 7.704s
  • JavaScript (node 8.1.3) — 8.358s
  • Rust (opt-level=3) — 9.873s
  • Julia 0.5 — 10.118s
  • Swift 3 — 14.349s
  • Python 3 — 16.597s
  • Python 2 — 16.944s
  • Perl — 17.553s
  • Kotlin — 17.619s
  • Ruby — 19.049s

The real times are reported. The results are for entertainment purposes and not to bash your choice of language or promote mine.

I didn't expect PyPy to do so well.

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.