Git Product home page Git Product logo

scala-benchmarking-template's Introduction

Scala Micro-Benchmarking Template

This is an SBT template project for creating micro benchmarks for scala code snippets. It's not much more than a simple wrapper around Caliper, an open-source library for properly running benchmark code on the JVM (written by some guys at Google).

Manually writing benchmarks for the JVM that actually measure what you intend to measure is much harder than it initially appears. There are quite a few rules you need to keep in mind, so it's best to rely on a framework that takes care of the details and let's you focus on the code relevant to your application. Caliper provides just this framework and this project makes it easily accessible for Scala developers.

How to create your own Scala micro-benchmark

  1. Git-clone this repository:

     $ git clone git://github.com/sirthias/scala-benchmarking-template.git my-benchmark
    
  2. Change directory into your clone:

     $ cd my-benchmark
    
  3. Launch SBT:

     $ sbt
    
  4. Run the existing benchmark:

     > run
    
  5. Start hacking on src/main/scala/org/example/Benchmark.scala

As a simple example the project already contains a small benchmark testing the performance of foreaching over a Scala Array against a simple while loop as well as a specialized, custom for loop replacement implementation. In order to run your own benchmark code simply replace the respectively marked code snippets with your own.

scala-benchmarking-template's People

Contributors

bigdogwillfeed avatar ymasory avatar sirthias avatar tekul avatar

Watchers

James Cloos avatar Jason Rudy 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.