GithubHelp home page GithubHelp logo

soxfox42 / tak Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 15 KB

tak is a benchmark thing ๐Ÿ‘

License: MIT License

Python 45.01% Shell 9.12% C 8.74% Factor 13.56% Lua 7.50% Forth 6.78% Rust 9.29%

tak's Introduction

Tak

Tak is a simple benchmark function. This repo contains some scripts I wrote to test various language implementations.

It is defined as follows:

def tak(x, y, z):
    if y < x:
        return tak(
            tak(x - 1, y, z),
            tak(y - 1, z, x),
            tak(z - 1, x, y),
        )
    else:
        return z

Current results - x = 48, y = 20, z = 12 - M1 MacBook Pro:

rust            | 0:00:00.973172
c               | 0:00:01.007381
luajit          | 0:00:03.208017
factor          | 0:00:06.010207
gforth          | 0:00:13.519273
uxntal          | 0:00:16.565155
lua             | 0:00:17.558004
python          | 0:00:33.063282

Note that Factor does not currently support arm64 processors, so it is running through Rosetta 2 translation in this run.

PRs Welcome!

I'd love to build up a collection of more languages, and while I plan to implement some more myself, I won't say no to help!

The general requirements for adding a new language:

  • Create a new folder for the language.
  • Add the implementation - usually named tak.foo, where foo is the relevant extension.
  • Add run.sh, which passes three arguments $1, $2 and $3 to the program.
  • For compiled languages, add build.sh to generate the compiled output.
  • The program must read the values of x, y, and z from argv.
  • The program must produce some sort of output, as this makes verification and debugging easier.
  • The program must implement the Tak function as specified above - I'm interested in raw performance, not the number of clever optimisations you can make.

tak's People

Contributors

flber avatar soxfox42 avatar

Watchers

 avatar

Forkers

flber

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.