Git Product home page Git Product logo

vector-foldright-benchmark's Introduction

Benchmarking balanced fold vs foldRight on Vector.

Variables

  • Size of vector: 2^20 vs 2^30 elements
  • Cost of the fold operation: finding the minimum of a Vector of ints (cheap) vs concatenating a Vector of strings (expensive)
  • Implementation: the standard collection lib's foldRight, vs 2 implementations of balancedFold (a naive one and a more performant one)

Results

[info] Benchmark                                                   Mode  Cnt     Score      Error  Units

// 2^20 elements, op = integer min
[info] FoldRightBenchmark.stdlibFoldRight_cheapOp                  avgt   20   397.995 ±   18.292  ns/op
[info] FoldRightBenchmark.balancedFold_cheapOp                     avgt   20  1589.875 ±  122.727  ns/op
[info] FoldRightBenchmark.balancedFold_optimised_cheapOp           avgt   20   181.784 ±   30.200  ns/op

// 2^30 elements, op = integer min
[info] FoldRightBenchmark.huge_stdlibFoldRight_cheapOp             avgt   20   602.981 ±   88.752  ns/op
[info] FoldRightBenchmark.huge_balancedFold_cheapOp                avgt   20  1959.538 ±   76.833  ns/op
[info] FoldRightBenchmark.huge_balancedFold_optimised_cheapOp      avgt   20   258.345 ±   69.954  ns/op

// 2^20 elements, op = string concatenation
[info] FoldRightBenchmark.stdlibFoldRight_expensiveOp              avgt   20  1175.649 ±  106.293  ns/op
[info] FoldRightBenchmark.balancedFold_expensiveOp                 avgt   20  4130.584 ±  368.484  ns/op
[info] FoldRightBenchmark.balancedFold_optimised_expensiveOp       avgt   20  2140.168 ±   85.843  ns/op

// 2^30 elements, op = string concatenation
[info] FoldRightBenchmark.huge_stdlibFoldRight_expensiveOp         avgt   20  1494.633 ±   20.967  ns/op
[info] FoldRightBenchmark.huge_balancedFold_expensiveOp            avgt   20  6322.657 ± 4191.283  ns/op
[info] FoldRightBenchmark.huge_balancedFold_optimised_expensiveOp  avgt   20  3707.640 ±  658.963  ns/op

And the winner is... inconclusive.

vector-foldright-benchmark's People

Stargazers

Masato Nakamura avatar Manabu Nakamura avatar kenji yoshida avatar

Watchers

Chris Birchall avatar kenji yoshida avatar James Cloos avatar  avatar

Forkers

gakuzzzz

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.