Commit Graph

698 Commits

Author SHA1 Message Date
Harendra Kumar
561bc1da24 Increase memory limit for Array.Foreign benchmark 2021-10-23 13:50:44 +05:30
Harendra Kumar
06e55120ce Rename Consumer to Refold
Consumer is a very generic name. One cannot intuitively distinguish
between Consumer and Fold. "Refold" gives a better idea that its a
slightly modified version of Fold with a starting value. Also, it fits
better as a dual to Unfold.
2021-10-22 01:34:02 +05:30
Harendra Kumar
c48ef0464b Improve NFData instance
This would make the comparison with prim arrays fairer.
2021-10-15 17:49:06 +05:30
Harendra Kumar
3201dc8328 Add consumeMany benchmark 2021-10-12 20:50:29 +05:30
Harendra Kumar
5342b1629f Add consumeIterateM benchmark 2021-10-12 20:50:29 +05:30
Harendra Kumar
0548e36d51 Rename Transformation1 benchmark module
to Transformation
2021-10-12 20:46:49 +05:30
Harendra Kumar
4179a3bdf2 Rename Transformation2 benchmark module to NestedFold 2021-10-12 20:46:49 +05:30
Harendra Kumar
55758dd5b7 Rename Nested benchmark module to NestedStream 2021-10-12 20:46:49 +05:30
Harendra Kumar
8dc51e8b05 Move Transformation3 benchmark module to Lift 2021-10-12 20:46:49 +05:30
Harendra Kumar
b4f6e6e860 Add a --quick option
--quick disables optimizations during build.
2021-10-12 18:57:14 +05:30
Harendra Kumar
58b7b77857 Make the seed in foldIterateM monadic 2021-10-10 14:17:06 +05:30
Harendra Kumar
cd29e5e2df Add toStreamK and toStreamKRev 2021-10-10 11:34:25 +05:30
Harendra Kumar
98a6a00a8c Increase the mem limit for Data.Array.Foreign build 2021-10-09 22:50:37 +05:30
Harendra Kumar
e265852671 Add skeleton for groupByRollingEither
The driving use case for this is to make the sorting faster by detecting
sorted sequences in the input.
2021-10-01 13:57:36 +05:30
Harendra Kumar
36c22e3b5b Add INLINE to zipWith and zipWithM 2021-09-30 09:38:39 +05:30
Harendra Kumar
68317a4a41 Fix/enhance benchmarks for concatPairsWith
* Add a benchmark for mergeByMFused
* Move interleaving benchmarks to WSerial module
* Rename some wserial benchmarks
* Add a Merge module for mergeBy/sorting benchmarks
2021-09-28 16:59:29 +05:30
Harendra Kumar
70e7f94691 Move IsStream definition out of low level modules
The IsStream type class contains MonadAsync type in the consM method.
This refactor allows lifting MonadAsync, therefore, dependency on
monad-control out of the low level modules.
2021-09-14 23:11:17 +05:30
Harendra Kumar
2842d5089c Fix ghcjs build taking too much memory 2021-09-06 06:09:40 +05:30
Harendra Kumar
2c4860045d Refactor and reformat 2021-09-05 05:39:45 +05:30
Harendra Kumar
e052c821b6 Add serial_ benchmark 2021-09-05 05:39:45 +05:30
Ranjeet Kumar Ranjan
878d734dd7 Implement some undefined functions in Fold module
Implement Some undefined in Internal.Data.Fold module

Add test cases for newly added functions

Add bench marks for newly added Data.Fold functions
2021-09-05 05:39:45 +05:30
Harendra Kumar
9b8398668a Fix array comparison benchmarks 2021-09-03 14:50:38 +00:00
Harendra Kumar
0cfd6251c1 Use limit-build-mem by default in bench/test scripts
Otherwise we may accidentally run into memory hog issues.
2021-09-03 03:57:40 +05:30
Ranjeet Kumar Ranjan
8d9396711c Remove map from Internal.Data.Fold 2021-09-01 18:14:37 +05:30
Ranjeet Kumar Ranjan
8d733b2209 Fix review comments and docspecs
Remove supplyMiddle and supplyNextFromStride

Fix enumerateFromNum for precision issue
2021-08-24 08:44:21 +05:30
Ranjeet Kumar Ranjan
ba9a4e8f6a Change signature of enumerate functions 2021-08-24 08:44:21 +05:30
Ranjeet Kumar Ranjan
6d98f4e135 Add Enumerable typeclass for Unfold 2021-08-24 08:43:19 +05:30
Harendra Kumar
a296fac8db Refactor SVar module
* Break it up into smaller modules with clearly separated functionality
* Keep minimal stuff in the lower level module SVar/Type, and push the
  rest in a higher level module to reduce dependencies of lower level
  modules. This will help in separating the lower modules in streamly-core
  package.
2021-08-20 00:47:56 +05:30
Adithya Kumar
17dfc5b087 Add benchmarks for retry 2021-08-09 21:21:33 +05:30
Adithya Kumar
69e3b2c010 Add unicode normalization bench-suite 2021-08-09 19:43:40 +05:30
Adithya Kumar
a322c073c3 Add benchmarks for Parser.choice 2021-08-09 16:36:48 +05:30
Ranjeet Kumar Ranjan
0b889318ed toStream/toStreamRev should be able to fold to any monad
Fix review comment

Fix benchmark

Fix warnings
2021-08-05 04:40:24 +05:30
Adithya Kumar
15397be802 Add benchmarks for takeP 2021-08-04 20:58:44 +05:30
Adithya Kumar
7830df9314 Add simple bench suite for Unicode.Utf8 2021-07-30 19:01:54 +05:30
Adithya Kumar
c9232b0e25 Extracted IO related common functions into a new module 2021-07-29 15:35:16 +05:30
Harendra Kumar
b9fe06b8ef Fix hlint issue (remove parens) 2021-07-29 05:03:07 +05:30
Harendra Kumar
bd451ec7ed Add an example, remove unused code 2021-07-29 02:15:46 +05:30
Harendra Kumar
ce8c5df5fc Make it portable for tasty-bench+streaming-benchmarks 2021-07-29 02:15:46 +05:30
Harendra Kumar
fb93af721d Add diff-style, diff-cutoff-percent to bench-runner 2021-07-29 02:15:46 +05:30
Harendra Kumar
12000346f5 Add diff-style and cutoff-percent to BenchReport 2021-07-29 02:15:46 +05:30
Harendra Kumar
2b8c70bfac Refactor and improve error reporting 2021-07-29 02:15:46 +05:30
Harendra Kumar
cffe01216b Move the bench-runner script to bench-report pkg 2021-07-29 02:12:40 +05:30
Harendra Kumar
ac3ed9a197 Move the generic bench runner scripts to bench-report 2021-07-29 02:12:40 +05:30
Harendra Kumar
3339c2082d Add fold and parse for array streams
The test and benchmark code is taken from Adithya's original double
ended lists based implementation.
2021-07-26 18:14:46 +05:30
Harendra Kumar
87571948f9 Add a section for identifying/fixing perf issues 2021-06-22 23:06:26 +05:30
Harendra Kumar
f309c32014 Simplify/compact some sections 2021-06-22 23:06:26 +05:30
Harendra Kumar
424f1e9871 Fix the space requirements of two benchmarks
Move showInstance benchmark for pure streams to o-n-space
Increase the heap space for array map x 4
2021-06-22 22:50:12 +05:30
Harendra Kumar
e09428332c Revert "Fix zipWith(M) to work concurrently according to the stream type"
This reverts commit 1ddcfc4634.

This requires MonadAsync constraint which breaks the existing
zipWith for pure streams e.g. 'SerialT Identity' (for example in
streaming-benchmarks package). We can possibly have different zipWith
APIs for concurrent zipping.
2021-06-22 12:39:07 +05:30
Harendra Kumar
67f851374c Inline MC.try to fix perf for GHC-9 2021-06-21 15:55:44 +05:30
Harendra Kumar
595331343a Update cabal/nix build code for bench-report 2021-06-17 17:08:05 +05:30
Ranjeet Kumar Ranjan
8fd51b2a37 Seperate chart build from benchmarks
Add extra-source-files to streamly.cabal

Fix review comments

Rename Chart.hs to BenchReport.hs

Fix extra-source-files

Remove no-charts flag
2021-06-17 17:08:05 +05:30
Harendra Kumar
eb16544f98 Use lowercased comparison for benchmark fields
For case insensitive comparison we were lowercasing the fields in the
benchmark csv header but not the fields being compared. So the fields
were not matching if we passed them in mixed case.
2021-06-15 01:43:50 +05:30
Harendra Kumar
3cd8e9bddf Print info messages on stderr instead of stdout
Otherwise it mixes with the output of benchmark list which we use in
scripts.
2021-06-08 23:54:04 +05:30
Harendra Kumar
c4358b3957 Fix Array.Pin.Pinned benchmark module name 2021-06-08 23:54:04 +05:30
Harendra Kumar
5537b0bfc2 Add --sort-by-name flag
To sort the benchmarks by name instead of sorting them by field value or
percent diff.
2021-06-08 23:54:04 +05:30
Harendra Kumar
03218ad71b Cleanup, fix issues in bench.sh 2021-06-08 23:54:04 +05:30
Ranjeet Kumar Ranjan
b68baf3c51 Add support for benchmarking with tasty-bench
tasty-bench has fewer dependencies and is agile to keep up with new GHC
versions. This change is especially motivated by support for GHC 9.0.1.
gauge depends on foundation/basement which lagging much behind and seem
to be unmaintained.
2021-06-08 23:54:04 +05:30
Harendra Kumar
d51fab489f Fix benchmark name prefixes to module names
Otherwise the new bench.sh changes for tasy-bench won't work for these
modules.
2021-06-08 23:54:04 +05:30
Harendra Kumar
28e17ee82e Fix a perf issue in iterate/iterateM
It was taking O(n) space, now it takes O(1)
2021-06-02 22:18:00 +05:30
Pranay Sashank
90be38762b Rename Fold.yield, yieldM to fromPure, fromEffect. 2021-05-30 22:24:54 +05:30
Pranay Sashank
f24ddc0bdf Rename Unfold.yield, yieldM to fromPure, fromEffect. 2021-05-30 22:24:54 +05:30
Pranay Sashank
70faf014ca Rename Streamly.Prelude.yieldM to fromEffect.
- Deprecate yieldM.
2021-05-29 02:05:01 +05:30
Pranay Sashank
4dfc6bf9ee Rename Streamly.Prelude.yield to fromPure.
- Deprecate yield.
2021-05-29 01:22:02 +05:30
Harendra Kumar
03cf686ca7 Export some pre-release array APIs
* getIndex
* casting ops
* writeLastN
* readRev
2021-04-27 13:37:56 +05:30
Harendra Kumar
6132eb3acb Split stdio ops into a Console.Stdio module
Change the FileSystem.Handle from* APIs to put*

Mutable write APIs would use a "put" prefix to make the name more intuitive.
2021-04-25 15:53:38 +05:30
Harendra Kumar
dc647f4a4e Change the argument order of intercalate and interpose 2021-04-24 16:17:39 +05:30
Harendra Kumar
a75c178599 Expose rollinghash and intercalate 2021-04-24 16:16:12 +05:30
Harendra Kumar
f64dd78449 Fix benchmark names, cleanup imports, fix hlint
Refactor only.
2021-04-24 13:36:28 +05:30
Adithya Kumar
cd916f54bb Move array stream bench/tests to separate modules 2021-04-19 19:38:14 +05:30
Ranjeet Kumar Ranjan
ac215ad43f Rename serially etc. to fromSerial etc. #1029 2021-04-16 00:20:54 +05:30
Harendra Kumar
0bfa00bb66 Fix heap overflow due to limit-build-mem issue 2021-04-15 02:02:57 +05:30
Ranjeet Kumar Ranjan
138d519601 concatPairsWith benchmarks #984 2021-04-07 14:06:34 +05:30
Adithya Kumar
1ddcfc4634 Fix zipWith(M) to work concurrently according to the stream type
https://github.com/composewell/streamly/issues/158
2021-04-06 02:34:54 +05:30
Adithya Kumar
f1f8d7ac5e Renamed function/bench names appropriatly in bench:StreamK
Also add a the benchmarks that need to be added
2021-03-31 17:42:09 +05:30
Adithya Kumar
029e6873e7 Fix filterScan. Revert to using maxBound over streamLen.
Quoting, harendra-kumar,

> Since we are adding the numbers in the stream, <= streamLen would terminate
> the stream much earlier. We should use maxBound instead. That's because we
> compose this with filter again in the mixed benchmarks
2021-03-30 17:02:18 +05:30
Adithya Kumar
876b904ecb Modify benchmarks to keep name comparisions backwards compatible 2021-03-30 17:02:18 +05:30
Adithya Kumar
98bc69e3d0 Rename value-ish to streamLen-ish in bench:StreamK
maxValue -> value
value -> streamLen
value2 -> streamLen2
value3 -> streamLen3
value16 -> streamLen16
2021-03-30 17:02:18 +05:30
Adithya Kumar
1079b49aab Collapse sourceUnfoldr(M)N into sourceUnfoldr(M) in bench:StreamK
As of this commit they are completely identical.
2021-03-30 17:02:18 +05:30
Adithya Kumar
ada707b778 Move passing benchmark properties to the root in bench:StreamK 2021-03-30 17:02:18 +05:30
Adithya Kumar
ad4bcce47f Remove unecessary code in bench:StreamK 2021-03-30 17:02:18 +05:30
Adithya Kumar
f1c19a6e85 Split O(1) space benchmarks into multiple groups in bench:StreamK 2021-03-30 17:02:18 +05:30
Adithya Kumar
23253c0270 Move global limits into function arguments in bench:StreamK 2021-03-30 17:02:18 +05:30
Adithya Kumar
c7cd7c877a Keep the INLINE statement & signature with function 4 bench:StreamK 2021-03-30 17:02:18 +05:30
Harendra Kumar
ae741f1bd8 Change the order of arguments in Unfold.fold
To keep it consistent with Stream.fold.
2021-03-26 20:27:56 +05:30
Adithya Kumar
27ccdf4d94 Move compilation memory restrictions under a flag 2021-03-26 16:40:43 +05:30
Harendra Kumar
0954511144 Refactor/rename/add basic unfold constructors 2021-03-24 21:19:18 +05:30
Harendra Kumar
8af1c368c6 Change signatures of zipWith/zipWithM 2021-03-24 20:38:56 +05:30
Harendra Kumar
a5e483b610 Refactor Unfold module
* Rearrange exports, export additional functions
* Update docs
* Disable applicative/monad/category/arrow instances
* Rename const to yieldM and add yield
* Remove "effect", it can be expressed by yieldM
* Change order of arguments for some functions
2021-03-24 01:40:30 +05:30
Ranjeet Kumar Ranjan
b73b5ffa3a Rename concatUnfold to unfoldMany #986 2021-03-22 19:05:17 +05:30
Ranjeet Kumar Ranjan
7759cc0082 Rename Unfold.concat to Unfold.many #985 2021-03-20 00:40:13 +05:30
Harendra Kumar
3b1a26cee5 Update Fold module docs and expose some APIs 2021-03-16 01:46:51 +05:30
Harendra Kumar
badc62d2b7 Rename stream transformation some APIs
Primary motivation for renaming takeEnd was to avoid confusion with
takeEndBy but I like the new name takeLast irrespective of that.
2021-03-14 01:02:10 +05:30
Adithya Kumar
92771949ad Fix import error 2021-03-12 01:30:23 +05:30
Adithya Kumar
a1472167de Make behaviour of Fold.many similar to that of foldMany/parseMany 2021-03-12 01:01:51 +05:30
Harendra Kumar
cd0a185607 Add NOINLINE for better optimization of loops 2021-03-12 01:01:51 +05:30
Ranjeet Kumar Ranjan
87ebad51cb Rename Types.hs modules to Type.hs 2021-03-11 15:12:08 +05:30
Harendra Kumar
e9a0e7c118 Move rmapM to Fold/Types.hs 2021-03-10 19:29:12 +05:30
Ranjeet Kumar Ranjan
4da398aa00 Change argument order in parser combinators #969
Keep the collecting fold as the last argument for ease of composition.
Data flows from one fold to the next, so the next fold in the chain
should be the last argument.
2021-03-09 23:10:43 +05:30
Adithya Kumar
7da0593dbb Add benchmarks for foldIterateM 2021-03-09 07:56:12 +05:30
Harendra Kumar
7910e05da7 Change the argument order in "many" 2021-03-08 19:53:20 +05:30
Harendra Kumar
d2e3430348 Rename some fold combinators
This commit has no functional change, only renaming and doc edits.
2021-03-07 23:04:41 +05:30
Harendra Kumar
fca88a49e8 Change the input stream type of classifySessionsBy
For more convenient operation.
2021-03-05 14:10:17 +05:30
Harendra Kumar
f7681dc897 Reorder the arguments in classifySessionsBy
For more convenient and intuitive use.
2021-03-05 13:04:35 +05:30
Ranjeet Kumar Ranjan
df38c4a8a4 Change splitWith to serialWith in folds and parsers 2021-03-05 11:46:59 +05:30
Ranjeet Kumar Ranjan
0414fe8ec6 Rename takeLE to take 2021-03-05 11:43:48 +05:30
Adithya Kumar
171907e2b3 Remove Applicative instance of Fold 2021-03-05 09:22:50 +05:30
Harendra Kumar
ca29fd279e Make it build for GHC-9.0 2021-03-04 18:25:45 +05:30
Harendra Kumar
2c21267a6d Fix fromStreamD performance
Before: not finishing in reasonable time
After: 686 us (similar to fromStream)
2021-02-22 14:07:35 +05:30
Harendra Kumar
c8b9fac92b Move parse functions to Source module
Plus:

* Fix returning buffer in the "parse" function
* Some more minor formatting/doc fixups.
2021-02-21 01:58:20 +05:30
Harendra Kumar
2a7e3ccdbc Rename the resumable Unfold type to Producer 2021-02-21 01:58:20 +05:30
Harendra Kumar
7c95ccaaad Use an explicit state to represent nested loops 2021-02-21 01:58:20 +05:30
Harendra Kumar
c93bad0134 Simplify the type of resumable Unfold 2021-02-21 01:58:20 +05:30
Harendra Kumar
22c83f40fd Add resumable unfolds for efficient nested parsing
Instead of using a closed loop we can stop an unfold and then resume it
later. This allows us to break the loop and restart it at some other
point. For example, we can parse a block from an input stream from a
file handle or a socket and then return the socket/handle plus nay
buffered data (due to backtracking) so that we can resume reading from
it later on after doing some processing.
2021-02-21 01:58:20 +05:30
Harendra Kumar
e6865109d1 Move the concat benchmark to Unfold module
Remove the NestedUnfoldOps module.
2021-02-20 10:41:58 +05:30
Harendra Kumar
77d11d37bb Add Monad instance for Unfold 2021-02-20 08:54:28 +05:30
Harendra Kumar
4f9fc7d2c9 Fix duplicate benchmark names
Move the fold benchmarks in stream module to the fold module.
2021-02-20 08:54:28 +05:30
Harendra Kumar
3947fee691 Add Applicative instance for Unfold 2021-02-20 08:51:30 +05:30
Harendra Kumar
2c70b45660 Implement concatPairswith/sortBy 2021-02-17 17:19:34 +05:30
Adithya Kumar
195606428c Add some nested benchmarks with parseMany 2021-02-14 22:46:43 +05:30
Adithya Kumar
b04187b602 Move parseMany benchamrks from FileSystem.Handle to Data.Parser 2021-02-14 14:37:37 +05:30
Pranay Sashank
9ebca6ec0a Add sequence_ benchmark for ParserD. 2021-02-11 15:01:41 +05:30
Pranay Sashank
c1c77d030e Add benchmark for Data.Fold.concatMap. 2021-02-11 15:01:02 +05:30
Ranjeet Kumar Ranjan
6976363939 Fix Some minor refactorings of toList/toStream folds #863
Fix refactoring issues in benchmark

Remove redundant import

Address review comments

Revert haddock reference
2021-02-11 00:40:24 +05:30
Harendra Kumar
11831bed44 Rename foldMany and foldMany1
foldMany1 is the default foldMany now. foldMany is renamed to
foldManyPost which is of limited use to split in an infix manner.
2021-02-11 00:37:12 +05:30
Adithya Kumar
27d3575855 Re-implement span, spanBy, and spanByRolling as parsers 2021-02-10 02:11:26 +05:30
Adithya Kumar
c5b6a8bfed Remove span, break, spanBy, and spanByRolling 2021-02-10 02:11:26 +05:30
Adithya Kumar
bf396f0db0 Add fold benchmarks for span, spanBy, and spanByRolling 2021-02-10 02:11:26 +05:30
Adithya Kumar
662aced6cc Add some derived parser benchmarks 2021-02-10 02:11:26 +05:30
Anurag Hooda
e4e1d25647 make sliceBeginWith fail when first element fails predicate 2021-02-07 20:05:01 +05:30
Anurag Hooda
fb9f05e4fb Add sliceBeginWith, tests and benchmarks 2021-02-07 20:05:01 +05:30
Harendra Kumar
b6a07525eb Use foldMany1 in chunksOf instead of foldMany 2021-02-06 22:29:22 +05:30
Harendra Kumar
a41a7b572f Use bigger stream sizes in some benchmarks 2021-02-06 00:12:42 +05:30
Harendra Kumar
de31277c19 Add foldMany1 and arraysOf benchmarks 2021-02-05 16:39:13 +05:30
Pranay Sashank
ed030cc134 Rename some modules.
- Streamly.Internal.Memory.ArrayStream =>
  Streamly.Internal.Data.Array.Stream.Foreign
- Streamly.Memory.Ring =>
  Streamly.Internal.Ring.Foreign
- Streamly.FileSystem.IOVec =>
  Streamly.Internal.FileSystem.IOVec
- Streamly.FileSystem.FDIO =>
  Streamly.Internal.FileSystem.FDIO
- Streamly.FileSystem.FD =>
  Streamly.Internal.FileSystem.FD

Closes #873.
2021-02-01 21:39:22 +05:30
Pranay Sashank
5c018c7e45 Rename Data.Array.Storable.Foreign to Data.Array.Foreign.
Closes #854.
2021-02-01 21:31:06 +05:30
Harendra Kumar
2c6f06c5b6 Increase memory limit for Prelude.Serial benchmark
Compiling Split.hs runs out of memory.
2021-01-28 01:19:53 +05:30
Harendra Kumar
f448fb5643 Refactor array modules (factor out array stream)
There is no functional change in this commit, only refactoring.

* Update module documentation for arrays
* Rearrange and re-group related functions together
* Ability to use fold/unfold/foldMany/chunksOf in low level array
  modules so that we are able to express some of the functions more
  idiomatically. We have not done that in this change but with this
  change we should be able to do it later.
* Separate out the array stream code from lower level modules to the
  higher level array stream module.
2021-01-28 01:19:44 +05:30
Harendra Kumar
6a33a88980 Increase time-limit from 0 to 0.01
In the "reverse'" benchmark the GC stats were showing as 0 because no
GC occurred in 1 iteration.
2021-01-27 19:08:13 +05:30
Adithya Kumar
1e099defbb Add benchmarks for Parser(D).groupByRolling 2021-01-26 20:56:25 +05:30
Adithya Kumar
9bcf1d6c8b Rename splitWith benchmark
split (all, any) -> splitWith
2021-01-24 19:02:53 +05:30
Harendra Kumar
7ce1771a28 Fix module dependencies due to Stream.Prelude 2021-01-18 12:48:35 +05:30
Adithya Kumar
9473e6bbbe Deprecate mapM and sequence in favor of rmapM and rsequence 2021-01-16 17:48:06 +05:30
Adithya Kumar
0753435d46 Rename Fold.lchunksOf to Fold.chunksOf 2021-01-16 07:12:16 +05:30
Adithya Kumar
32e519cb8c Rename Fold.lmap to Fold.map 2021-01-16 07:12:16 +05:30
Adithya Kumar
084cdea601 Rename Fold.ltake to Fold.takeLE 2021-01-16 07:12:16 +05:30
Anurag Hooda
86745a756d Rename slicesepby to slicesepbyP, some formatting changes 2021-01-14 19:17:31 +05:30
Anurag Hooda
5ccf51dcae Implement slicesepby, add tests and benchmarks 2021-01-14 19:17:31 +05:30
Anurag Hooda
656bfc6bc8 Add tests and benchmarks for takeBetween 2021-01-04 18:30:29 +05:30
Harendra Kumar
58cb9caffa Move the bench.sh script to "bin" dir 2020-12-28 23:56:18 +05:30
Harendra Kumar
299bdffdd6 Add a script to run tests
This allows us to build and run individual tests or groups of tests. The
script is supposed to be extended to run hpc/coverage manually after
running the tests.

Note: cabal fails to run coverage if the test module is separated from
the library.
2020-12-28 23:56:18 +05:30