GithubHelp home page GithubHelp logo

fonghou / effects-benchmarks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patrickt/effects-benchmarks

0.0 1.0 0.0 24 KB

Benchmarking Haskell extensible-effect libraries.

License: BSD 3-Clause "New" or "Revised" License

Haskell 100.00%

effects-benchmarks's Introduction

effects-benchmarks

This is a set of memory and time benchmarks for the various Haskell effects libraries, including fused-effects, polysemy, freer-simple, and extensible-effects. Benchmarks for equivalent mtl and handwritten computations are included for comparison purposes. It uses Cabal's new Backpack feature to save a great deal of boilerplate code.

tl;dr

fused-effects and mtl achieve roughly commensurate performance. polysemy is within one to three orders of magnitude from fused-effects and mtl. freer-simple and extensible-effects are considerably slower.

Full results

On a 15-inch 2017 MacBook Pro (3.1GHz Intel i7, 16GB RAM), here are results for space benchmarks:

Countdown

  Case                Allocated
  fused-effects              40
  mtl                        40
  polysemy                1,304
  freer-simple            1,096
  extensible-effects      1,304
  shallow                   232

Countdown + exc

  Case                Allocated  GCs
  fused-effects             336
  mtl                       336
  polysemy                  792
  freer-simple              864
  extensible-effects        984
  shallow                   320

(The fact that fused-effects and mtl have the same allocations is not an error; fused-effects was designed to have almost identical performance characteristics to mtl.)

Time (State-based countdown):

benchmarked Countdown/Put/fused-effects
time                 5.692 μs   (5.570 μs .. 5.835 μs)

benchmarked Countdown/Put/mtl
time                 5.500 μs   (5.386 μs .. 5.719 μs)

benchmarked Countdown/Put/polysemy
time                 1.903 ms   (1.845 ms .. 1.954 ms)

benchmarked Countdown/Put/freer-simple
time                 1.324 ms   (1.282 ms .. 1.361 ms)

benchmarked Countdown/Put/extensible-effects
time                 1.383 ms   (1.343 ms .. 1.422 ms)

benchmarked Countdown/Put/shallow
time                 275.1 μs   (270.1 μs .. 281.6 μs)

Time (State + Error countdown):

benchmarked Countdown/Put+Exc/fused-effects
time                 9.829 μs   (9.645 μs .. 10.04 μs)

benchmarked Countdown/Put+Exc/mtl
time                 9.968 μs   (9.779 μs .. 10.15 μs)

benchmarked Countdown/Put+Exc/polysemy
time                 418.1 μs   (408.9 μs .. 427.1 μs)

benchmarked Countdown/Put+Exc/freer-simple
time                 1.157 ms   (1.120 ms .. 1.199 ms)

benchmarked Countdown/Put+Exc/extensible-effects
time                 1.232 ms   (1.212 ms .. 1.262 ms)

benchmarked Countdown/Put+Exc/shallow
time                 55.12 μs   (54.34 μs .. 56.29 μs)

Time (custom HTTP DSL):

benchmarked HTTP/fused-effects
time                 8.311 μs   (8.060 μs .. 8.592 μs)

benchmarked HTTP/polysemy
time                 14.99 ms   (14.26 ms .. 15.80 ms)

benchmarked HTTP/extensible-effects
time                 1.612 ms   (1.578 ms .. 1.654 ms)

benchmarked HTTP/Deep embedding
time                 2.027 ms   (1.876 ms .. 2.184 ms)

benchmarked HTTP/Shallow embedding
time                 15.94 μs   (15.49 μs .. 16.46 μs)

benchmarked HTTP/freer-simple
time                 1.478 ms   (1.443 ms .. 1.515 ms)

Future work

  • More benchmarks: Writer, logging, grammar, pipes.
  • polysemy can probably get some more speed out of it: some of these results are slightly baffling.
  • I am going to make this emit pretty graphs, or at least graphable .csv files, someday.

effects-benchmarks's People

Watchers

 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.