Git Product home page Git Product logo

benchlang's Introduction

benchlang

This project aims to be a tool, a collection of measures and a website about benchmarking languages and their implementations. Measures are nice; interpretation of those measures is up to human beings.

Dependencies
  • GNU/Linux (may extend to POSIX systems)

  • g++

  • find command

  • LuaJIT

  • luarocks lua-messagepack, argparse (5.1)

  • anything that the environments require

Build
# build lib
./build.sh

# download submodules
git submodule init
git submodule update

# generate data files
luajit gen-data.lua
Usage examples
help

luajit benchmark.lua -h

basic usage

luajit benchmark.lua <host> [options]

test an implementation

luajit benchmark.lua my_host -lc -e gcc -w fibonacci-nr -i my_impl.c

comparison

luajit benchmark.lua my_host -w fibonacci-nr -llua -lc

💡
Any specific language, work, environment or implementation names can be specified to narrow the kind of results to produce. Already valid produced results are not recomputed unless the --force -f flag is used.
⚠️
No safety/sandboxing is implemented for the executed scripts/programs.

Concepts

Measures are generated in the results/ directory for a specific host, a specific language, a specific environment, a specific work and a specific implementation of this work.

Each result file is bound to a specific work/environment’s version and an implementation’s content (hash), if they change, the result file will be ignored by the site/reports (and recomputed by the benchmark script).

Language

A programming language.

ℹ️
It’s a matter of choice to decide if language versions are defined as different languages or different environments; it may be better to have them as environments and hint the version in the implementation name.

Environment

A specific language builder/VM/etc executing an implementation’s source code.

💡
The script may use OS environment variables to adapt to the user system. Custom environment variables should be prefixed by BL_ to avoid conflicts.

Work

Something that must be done by the languages; Different set of parameters and expected outputs are used to verify that the work has been done correctly.

ℹ️
Steps should increase gradually in computational complexity to give meaningful measures for fast and slow results.

Implementation

An implementation of a specific work in a specific language.

All implementations will run in each language’s environment, but they are not required to work on all of them; the result will just be invalid for those.

💡
Implementation’s file name may contain anything concise and useful to identify it, but using the algorithm/work’s name is useless; this information is already present in the file path.

Variables

Variables can be assigned in the implementation using this pattern inside comments:

!BENCHLANG:<host>:<env>(<var>)=[<value>]

💡
An empty host or env is equivalent to any.
Examples
  • !BENCHLANG::(LIBS)=[-pthread]

  • !BENCHLANG::gcc-any(OPTS)=[-march=native]

  • !BENCHLANG::(LIBS)=[-pthread] (set any)

    !BENCHLANG:specific_host:(LIBS)=[-lpthread] (exception for this host)

Host

Describes all the information about the machine/OS where the work is executed and common parameters used to generate the results for all languages.

ℹ️
Using a timeout of 60 seconds may be a good choice.
  • already a lot of computation for a modern CPU

  • enough to get meaningful measures with gradually complex work’s steps

  • fast enough to get a lot of measures and recompute some if needed

Contributions

Contributions of hosts, results, works, languages, environments and implementations are welcomed.

Notes
hosts, results

specific host and associated results should probably be maintained by the same machine owner

languages, environments

when adding a new language, add a basic standard environment

implementations
  • changes to an existing implementation will invalidate all computed results, forking the implementation may be a better practice

  • implementations should explicit their own license/authors in the source file (when they don’t, they are direct parts of the project and use the same license)

  • they should not be tuned for specific work steps' parameters, but can be tuned for general practical parameters

  • they should only use features generally expected to be available for the specific hosts, language and environments they might run in (in other words, avoid being tuned for the benchmark environment)

  • they should comply to the associated work rules (constraints, etc)

ℹ️
Some works may impose constraints to narrow the meaning of measures, others may give complete freedom to make the implementation as good as possible (looking at the best implementations may give insight about the complexity of such codes and if it’s worth the effort).

File organization

hosts/<host>.lua

host files

works/<work>.lua

work files

langs/<lang>/config.lua

lang files

langs/<lang>/envs/<env>.lua

environment files

langs/<lang>/impls/<work>/<impl>

implementation files

results/<host>/<lang>/<env>/<work>/<impl>.data

result files

Results

Multiple measures will probably be taken for each work/parameters couple, they will be aggregated for the website/reports.

Aggregation for final reported measures
memory

maximum of all measures

time

minimum of all measures

benchlang's People

Contributors

imagicthecat avatar jlimperg avatar

Stargazers

Kiswono Prayogo avatar

Watchers

James Cloos avatar  avatar

benchlang's Issues

Use AsciiDoc.

Before #5.

Simplify, doesn't rely on GitHub for web output.

DISCARD implementation variable.

Ex: !BENCHLANG:<host>:<env>(DISCARD)=[yes]

Could be used to discard computation for some envs/hosts for a specific implementation.

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.