{"id":20761948,"url":"https://github.com/composewell/streaming-benchmarks","last_synced_at":"2025-04-05T22:10:36.941Z","repository":{"id":48699527,"uuid":"98449551","full_name":"composewell/streaming-benchmarks","owner":"composewell","description":"Benchmarks to compare Haskell streaming library performance","archived":false,"fork":false,"pushed_at":"2024-11-17T04:15:15.000Z","size":1337,"stargazers_count":103,"open_issues_count":3,"forks_count":9,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-29T21:09:14.891Z","etag":null,"topics":["benchmarks","haskell","performance","streaming"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/composewell.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-26T17:38:39.000Z","updated_at":"2024-12-25T03:34:53.000Z","dependencies_parsed_at":"2024-11-15T22:21:24.114Z","dependency_job_id":"650154b6-84e6-4a48-afee-4c5f9d3b90f8","html_url":"https://github.com/composewell/streaming-benchmarks","commit_stats":{"total_commits":297,"total_committers":7,"mean_commits":42.42857142857143,"dds":"0.043771043771043794","last_synced_commit":"07428b8d65f67b2ea9c3e9bfb6d8d77d71b716c9"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/composewell%2Fstreaming-benchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/composewell%2Fstreaming-benchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/composewell%2Fstreaming-benchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/composewell%2Fstreaming-benchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/composewell","download_url":"https://codeload.github.com/composewell/streaming-benchmarks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406111,"owners_count":20933806,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmarks","haskell","performance","streaming"],"created_at":"2024-11-17T10:28:13.151Z","updated_at":"2025-04-05T22:10:36.913Z","avatar_url":"https://github.com/composewell.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Streaming Benchmarks\n\n[![Hackage](https://img.shields.io/hackage/v/streaming-benchmarks.svg?style=flat)](https://hackage.haskell.org/package/streaming-benchmarks)\n[![Gitter chat](https://badges.gitter.im/composewell/gitter.svg)](https://gitter.im/composewell/streamly)\n[![Build Status](https://travis-ci.org/composewell/streaming-benchmarks.svg?branch=master)](https://travis-ci.org/composewell/streaming-benchmarks)\n[![Windows Build status](https://ci.appveyor.com/api/projects/status/8d1kgrrw9mmxv5xt?svg=true)](https://ci.appveyor.com/project/harendra-kumar/streaming-benchmarks)\n\nThis package provides micro-benchmarks to measure and compare the\nperformance of various streaming implementations in Haskell.\n\nWe have taken due to care to make sure that we are\nbenchmarking correctly and fairly. See [the notes on correct\nbenchmarking](docs/benchmarking-notes.md).\n\nDISCLAIMER: This package is a result of benchmarking effort done during the\ndevelopment of [streamly](https://github.com/composewell/streamly) by the\nauthors of [streamly](https://github.com/composewell/streamly).\n\n## Benchmarks\n\nThe benchmark names are obvious, some of them are described below.  Single\noperation benchmarks:\n\n| Name           | Description                                                 |\n| -------------- | ----------------------------------------------------------- |\n| `drain`        | Just discards all the elements in the stream                |\n| `drop-all`     | drops all element using the ``drop`` operation              |\n| `last`         | extract the last element of the stream                      |\n| `fold`         | sum all the numbers in the stream                           |\n| `map`          | increments each number in the stream by 1                   |\n| `take-all`     | Use ``take`` to retain all the elements in the stream       |\n| `filter-even`  | Keep even numbers, discard odd                              |\n| `scan`         | scan the stream using ``+`` operation                       |\n| `mapM`         | transform the stream using a monadic action                 |\n| `zip`          | combines corresponding elements of the two streams together |\n\nComposite operation benchmarks:\n\n| Name           | Description                                                 |\n| -------------- | ----------------------------------------------------------- |\n| `map x 4`      | perform `map` operation 4 times |\n| `take-map`     | `take` followed by a `map` |\n\nFor more details on how each benchmark is implemented see\n[this benchmark file](https://github.com/composewell/streaming-benchmarks/blob/master/Benchmarks/Streamly.hs).\n\nEach benchmark is run in a separate process to avoid any effects of GC\ninterference and sharing across benchmarks.\n\n## Benchmark Results\n\nBelow we present some results comparing\n[streamly](https://github.com/composewell/streamly) with other streaming\nimplementations.\nDue care has been taken to keep the comparisons fair.  We have optimized\neach library's code to the best of our knowledge, please point out if\nyou find any measurement issues.\n\n## Running Benchmarks\n\nYou can run individual benchmarks using `cabal bench \u003ctarget\u003e`. You may\nneed to specify a build flag to include a particular streaming library\ne.g. `--flag pipes` to benchmark the `pipes` library. Please consult the cabal\nfile to find the exact flag names.\n\n### Generating Comparison Reports\n\nYou can generate the comparison reports presented in this page yourself.\nTo do so you need to run the benchmarks using the reporting tool, first build\nthe reporting tool using the following command:\n\n```\n$ cd bench-runner\n$ cabal install --project-file cabal.project.user --installdir ../bin\n```\n\nIf you want to create a report for benchmarks showing a 10% or greater\nimprovement with Streamly over Lists, use:\n\n```\n$ bin/bench-runner --package-name streaming-benchmarks --package-version 0.4.0 --compare --diff-cutoff-percent 10 --diff-style absolute --targets \"StreamlyPure List\"\n```\n\nAfter running once, you can add `--no-measure` option to use the same benchmark\nmeasurements for different reports.  For example, use:\n\n* `--diff-cutoff-percent -10` to know where lists are better than streamly\n* `--diff-style multiples` to generate ratios instead of absolute values\n\n### Streamly vs Haskell Lists\n\nStreamly, when used with `Identity` monad, is almost the same as Haskell lists\n(in the `base` package).\n[See this](https://github.com/composewell/streamly/blob/master/docs/streamly-vs-lists.md)\nfor more details.\n\nThe following table compares the timing of several operations for\n[streamly](https://github.com/composewell/streamly)\nwith lists using a one million element stream.  For brevity only\nthose operations where the performance of the two packages differ by\nmore than 10% are shown in the table below. The last column shows how\nmany times slower list is compared to streamly.\n\n| Benchmark           | streamly(μs) |  list(μs)  | list/streamly |\n| ------------------- | ------------ | ---------- | ------------- |\n| drop-map x 4        |    375.09    |  76925.32  | 205.08        |\n| filter-drop x 4     |    382.03    |  54848.54  | 143.57        |\n| drop-scan x 4       |    795.81    |  76716.79  |  96.40        |\n| filter-scan x 4     |    795.60    |  44559.15  |  56.01        |\n| scan-map x 4        |   1192.19    |  48838.22  |  40.97        |\n| take-map x 4        |   1500.99    |  60126.58  |  40.06        |\n| filter-take x 4     |   1502.01    |  48766.87  |  32.47        |\n| take-drop x 4       |   1499.62    |  41720.03  |  27.82        |\n| take-scan x 4       |   1874.94    |  51283.30  |  27.35        |\n| drop-one x 4        |    375.33    |   8993.87  |  23.96        |\n| dropWhile-false x 4 |    374.61    |   8957.79  |  23.91        |\n| dropWhile-false     |    374.83    |   8670.05  |  23.13        |\n| drop-one            |    390.77    |   8681.85  |  22.22        |\n| dropWhile-true      |    571.60    |  12237.48  |  21.41        |\n| drop-all            |    562.94    |   8262.38  |  14.68        |\n| take-all            |    624.83    |    564.34  |  1/1.11       |\n| scan x 4            |    795.83    |    385.85  |  1/2.06       |\n| appendR[10000]      |    360.75    |    126.95  |  1/2.84       |\n| concatMap           |   34957.71   |   1124.85  |  1/31.08      |\n\n* streamly-0.8.0, base-4.14.1.0, ghc-8.10.4, Linux\n\nTo generate these reports run `bench-runner` with:\n\n* `--targets \"StreamlyPure List\"`\n\n### Streamly vs Streaming\n\nThe following table compares the timing of several operations\nfor [streamly](https://github.com/composewell/streamly) with\n[streaming](https://hackage.haskell.org/package/streaming) using a\nmillion element stream.\n\n| Benchmark           | streamly(μs) | streaming(μs) | streaming/streamly |\n| ------------------- | ------------ | ------------- | ------------------ |\n| appendR[10000]      |       326.56 |    1301176.69 |            3984.54 |\n| mapM x 4            |       374.42 |     223591.08 |             597.17 |\n| filter-map x 4      |       381.07 |     194903.88 |             511.47 |\n| filter-scan x 4     |       795.66 |     233527.90 |             293.50 |\n| filter-all-in x 4   |       375.40 |     102629.64 |             273.38 |\n| filter-drop x 4     |       387.15 |      99096.98 |             255.96 |\n| map x 4             |       386.49 |      94944.87 |             245.66 |\n| drop-map x 4        |       375.62 |      89669.37 |             238.73 |\n| scan x 4            |       797.00 |     166332.40 |             208.70 |\n| scan-map x 4        |      1194.30 |     238804.48 |             199.95 |\n| filter-even x 4     |       396.37 |      77865.47 |             196.45 |\n| drop-scan x 4       |       796.98 |     156063.52 |             195.82 |\n| takeWhile-true x 4  |       562.49 |      90183.53 |             160.33 |\n| scan                |       375.24 |      47520.57 |             126.64 |\n| filter-take x 4     |      1498.55 |     189635.34 |             126.55 |\n| mapM                |       388.10 |      46689.61 |             120.30 |\n| take-map x 4        |      1500.71 |     178954.50 |             119.25 |\n| zip                 |       656.65 |      66689.73 |             101.56 |\n| take-scan x 4       |      2380.35 |     241675.75 |             101.53 |\n| filter-all-in       |       375.97 |      33590.14 |              89.34 |\n| map                 |       375.02 |      33081.13 |              88.21 |\n| filter-even         |       393.26 |      30458.46 |              77.45 |\n| filter-all-out      |       382.87 |      26826.21 |              70.07 |\n| take-all x 4        |      1499.71 |     101332.53 |              67.57 |\n| take-drop x 4       |      1498.53 |      98281.99 |              65.59 |\n| takeWhile-true      |       562.62 |      31863.25 |              56.63 |\n| foldl'              |       388.22 |      18503.15 |              47.66 |\n| drop-all            |       562.08 |      25200.32 |              44.83 |\n| take-all            |       768.65 |      33247.97 |              43.26 |\n| dropWhile-true      |       564.87 |      24431.50 |              43.25 |\n| last                |       385.53 |      15240.85 |              39.53 |\n| dropWhile-false     |       374.83 |      14566.70 |              38.86 |\n| drop-one            |       374.80 |      14565.01 |              38.86 |\n| drop-one x 4        |       375.88 |      14448.67 |              38.44 |\n| dropWhile-false x 4 |       390.12 |      14619.42 |              37.47 |\n| drain               |       375.06 |      13702.29 |              36.53 |\n| toList              |    117708.83 |     201444.81 |               1.71 |\n\n* streamly-0.8.0, streaming-0.2.3.0, ghc-8.10.4, Linux\n\nTo generate these reports run `bench-runner` with:\n\n* `--targets \"Streamly Streaming\" --cabal-build-options \"--flag streaming\"`\n\n### Streamly vs Pipes\n\nThe following table compares the timing of several operations\nfor [streamly](https://github.com/composewell/streamly) with\n[pipes](https://hackage.haskell.org/package/pipes) using a\nmillion element stream.\n\n| Benchmark           |  streamly(μs)  |  pipes(μs)  | pipes/streamly |\n| ------------------- |  ------------  |  ---------  | -------------- |\n| appendR[10000]      |        327.90  |  901135.92  |        2748.21 |\n| mapM x 4            |        375.20  |  407184.39  |        1085.23 |\n| filter-map x 4      |        381.52  |  366759.70  |         961.31 |\n| drop-map x 4        |        375.48  |  281296.82  |         749.16 |\n| filter-all-in x 4   |        375.60  |  222331.68  |         591.93 |\n| filter-drop x 4     |        387.44  |  222830.71  |         575.14 |\n| drop-scan x 4       |        797.23  |  336737.89  |         422.39 |\n| filter-even x 4     |        389.87  |  152688.91  |         391.64 |\n| filter-scan x 4     |        797.38  |  309733.91  |         388.44 |\n| drop-one x 4        |        375.48  |  139851.13  |         372.46 |\n| map x 4             |        386.56  |  136289.32  |         352.57 |\n| dropWhile-false x 4 |        390.72  |  137395.44  |         351.65 |\n| scan-map x 4        |       1194.38  |  381286.88  |         319.23 |\n| takeWhile-true x 4  |        562.86  |  165143.23  |         293.40 |\n| scan x 4            |        796.68  |  222986.17  |         279.90 |\n| mapM                |        388.19  |   95576.97  |         246.21 |\n| filter-all-in       |        375.21  |   71297.42  |         190.02 |\n| take-map x 4        |       1502.76  |  275887.24  |         183.59 |\n| scan                |        374.81  |   65549.13  |         174.89 |\n| take-drop x 4       |       1503.43  |  256448.45  |         170.58 |\n| filter-even         |        390.29  |   66183.72  |         169.57 |\n| filter-all-out      |        376.99  |   59074.54  |         156.70 |\n| drop-one            |        375.19  |   58395.24  |         155.64 |\n| dropWhile-false     |        375.35  |   58223.03  |         155.12 |\n| map                 |        375.05  |   57736.43  |         153.94 |\n| filter-take x 4     |       1503.00  |  227925.71  |         151.65 |\n| take-scan x 4       |       2455.91  |  354284.33  |         144.26 |\n| zip                 |        657.07  |   86011.93  |         130.90 |\n| takeWhile-true      |        564.14  |   61390.21  |         108.82 |\n| take-all x 4        |       1502.32  |  139730.70  |          93.01 |\n| dropWhile-true      |        564.03  |   49227.19  |          87.28 |\n| drop-all            |        562.05  |   46505.37  |          82.74 |\n| take-all            |        824.09  |   60511.34  |          73.43 |\n| drain               |        375.29  |   26390.59  |          70.32 |\n| foldl'              |        397.34  |   19064.05  |          47.98 |\n| last                |        387.11  |   17364.44  |          44.86 |\n| toList              |     117257.09  |  207405.94  |           1.77 |\n\n* streamly-0.8.0, pipes-4.3.16, ghc-8.10.4, Linux\n\nTo generate these reports run `bench-runner` with:\n\n* `--targets \"Streamly Pipes\" --cabal-build-options \"--flag pipes\"`\n\n### Streamly vs Conduit\n\nThe following table compares the timing of several operations\nfor [streamly](https://github.com/composewell/streamly) with\n[conduit](https://hackage.haskell.org/package/conduit) using a\nmillion element stream.\n\n| Benchmark           | streamly(μs) | conduit(μs)  | conduit/streamly |\n| ------------------- | ------------ | -----------  | ---------------- |\n| mapM x 4            |       375.46 |   297002.31  |           791.04 |\n| filter-map x 4      |       380.79 |   267543.81  |           702.60 |\n| drop-map x 4        |       375.66 |   232307.84  |           618.39 |\n| filter-drop x 4     |       386.05 |   235029.15  |           608.81 |\n| filter-scan x 4     |       796.56 |   306556.67  |           384.85 |\n| drop-scan x 4       |       797.19 |   300789.06  |           377.31 |\n| zip                 |       657.29 |   210069.05  |           319.60 |\n| filter-all-in x 4   |       375.24 |   118506.68  |           315.82 |\n| scan-map x 4        |      1194.67 |   360671.18  |           301.90 |\n| map x 4             |       387.00 |   113497.14  |           293.27 |\n| drop-one x 4        |       375.49 |   101842.95  |           271.23 |\n| dropWhile-false x 4 |       389.44 |   102051.22  |           262.04 |\n| scan x 4            |       796.72 |   190479.35  |           239.08 |\n| takeWhile-true x 4  |       564.58 |   114459.57  |           202.73 |\n| filter-even x 4     |       391.76 |    72369.30  |           184.73 |\n| filter-take x 4     |      1502.04 |   267921.27  |           178.37 |\n| take-map x 4        |      1502.88 |   238875.95  |           158.95 |\n| take-drop x 4       |      1500.34 |   232606.19  |           155.04 |\n| take-scan x 4       |      2443.83 |   309738.86  |           126.74 |\n| mapM                |       389.15 |    41897.48  |           107.66 |\n| scan                |       375.40 |    38137.85  |           101.59 |\n| take-all x 4        |      1502.32 |   110682.74  |            73.67 |\n| filter-all-in       |       375.31 |    26024.21  |            69.34 |\n| dropWhile-false     |       375.10 |    25307.13  |            67.47 |\n| map                 |       375.18 |    23088.09  |            61.54 |\n| drop-one            |       375.43 |    22020.65  |            58.65 |\n| filter-even         |       392.28 |    21504.28  |            54.82 |\n| takeWhile-true      |       562.79 |    29012.68  |            51.55 |\n| filter-all-out      |       378.76 |    15736.05  |            41.55 |\n| drop-all            |       562.89 |    19916.48  |            35.38 |\n| foldl'              |       388.88 |    12499.03  |            32.14 |\n| dropWhile-true      |       564.43 |    17983.35  |            31.86 |\n| take-all            |       784.67 |    24425.36  |            31.13 |\n| last                |       385.75 |    10974.84  |            28.45 |\n| drain               |       375.18 |     4272.15  |            11.39 |\n| appendR[10000]      |       326.93 |     1207.88  |             3.69 |\n| toList              |    116441.26 |   199138.09  |             1.71 |\n\n* streamly-0.8.0, conduit-1.3.4.1, ghc-8.10.4, Linux\n\nTo generate these reports run `bench-runner` with:\n\n* `--targets \"Streamly Conduit\" --cabal-build-options \"--flag conduit\"`\n\n## Stack and heap utilization\n\n`bench-runner` also generates a `maxrss` comparison report, displaying the\nmaximum resident memory for each benchmark.\n\n## Comparing other libraries\n\nThis package supports many streaming libraries, bytestring, text, vector etc.\nYou can run the benchmarks directly or use `bench-runner` to create comparison\nreports. Check out the targets in the cabal file.\n\n## Adding New Libraries\n\nIt is trivial to add a new package. This is how\n[a benchmark file](https://github.com/composewell/streaming-benchmarks/blob/master/Benchmarks/Streamly.hs)\nfor a streaming package looks like. Pull requests are welcome, we will be happy\nto help, [just join the gitter chat](https://gitter.im/composewell/streamly)\nand ask!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomposewell%2Fstreaming-benchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomposewell%2Fstreaming-benchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomposewell%2Fstreaming-benchmarks/lists"}