Commit Graph

46 Commits

Author SHA1 Message Date
Harendra Kumar
7d577a469b Add detailed benchmarks for folds
INLINE foldlM'
2018-12-29 21:10:02 +05:30
Harendra Kumar
d08c057f8f Add Enumerable type class 2018-12-29 16:22:29 +05:30
Harendra Kumar
d01942d9dd Add applicative benchmarks
Specialize asyncly/wAsyncly/aheadly applicative instances
2018-12-29 15:23:47 +05:30
Harendra Kumar
ede29df8d0 specialize the typeclass instances to recover performance 2018-12-28 12:25:52 +05:30
Harendra Kumar
dbc1956141 Review of #138 (Prelude functions) and other changes
APIs
----

Removed:
  merge
  lazy left scans: scanl, scanlM, scanl1, scanl1M

Renamed:
  generate and generateM renamed to fromIndices and fromIndicesM

Added:
  replicate
  mergeByM, mergeAsyncBy, mergeAsyncByM
  `intFrom`, `intFromTo`, `intFromThen`, `intFromThenTo`,
  `intFromStep`, `fracFrom`, `fracFromThen`, `fracFromThenTo`,
  `numFromStep`

Added StreamD version of replicateM and a rewrite rule for replicateMSerial.

Added but not exposed:
  postscanl and prescanl ops

Rewrote mergeByS in StreamK, simplified quite a bit and got some perf
improvement too.

Added @since notations to new APIs.

Fixed lines exceeding 80 columns.

Tests
-----

Added tests for the new enumeration APIs.
Improved some tests by generating values randomly using quickcheck forAll. We
can improve more tests similarly.

Removed some redundant transformOps tests.

reorganized test code in groups so as to keep similar functionality together
and added header lines so that we can find relevant code easily.

Benchmarks
----------

Added benchmarks for enumeration primitives added above. Added benchmarks for
scan and fold mixed ops. Added benchmark for concatMap. Fixed foldr and foldrM
benchmarks to use a (+) operation instead of a list operation for fair
comparision with other folds.

Kept only one benchmark each for deleteBy, insertBy, isPrefixOf and
isSubsequenceOf.

Documentation
-------------

Updated documentation, added examples for the new primitives as well as many
old ones. Especially the documentation of folds and scans was rewritten.

Reordered and re-organized the groups of APIs in the doc.

Refactoring
-----------

Some related and urelated refactoring.

Hlint
-----

Fixed some hlint hints introduced recently.

TBD
---

Some APIs need concurrent versions. I have added "XXX" notes for those.
Some more tests have to be added.
Some more benchmarks have to be added.
2018-12-09 19:39:37 +05:30
Pranay Sashank
dbcf5363e8 Add isPrefixOf, isSubsequenceOf, stripPrefix to Prelude, StreamD. 2018-11-22 10:03:00 +05:30
Pranay Sashank
55e582efaf INLINE insert and delete in benchmarks. 2018-11-22 10:02:04 +05:30
Pranay Sashank
acc38719fd Fixed insertBy to use correct state. Add deleteBy.
- Benchmarks show very poor performance of insertBy and
deleteBy compared to StreamK. Should be improved in StreamD.
2018-11-22 10:02:04 +05:30
Pranay Sashank
7f82af409c Add scanl1, scanl1M, scanl1', scanl1M', scanl, scanlM to StreamD. 2018-11-22 10:00:38 +05:30
Pranay Sashank
3186bd283f Add maximumBy and minimumBy. 2018-11-22 09:56:48 +05:30
Pranay Sashank
5cc6933cdb Add (!!), insertBy, merge, mergeBy, splitAt, the to Prelude.
1) Add foldr1, findIndices, lookup, find, sequence functions
in StreamD, earlier they were present only in StreamK.
2) Change the above functions to use S. in Prelude instead
of K. .
3) Add tests for (!!), insertBy, splitAt, the.
2018-11-22 09:53:40 +05:30
Harendra Kumar
6daacf0d49 Add foldl' benchmark for pure streams to cmp with Foldable 2018-11-19 12:44:53 +05:30
Harendra Kumar
11d8d6dc66 Fix foldable/traversable instances
1) Define the instances manually instead of deriving. Deriving picks up
incorrect implementations of methods that have been redefined in the newtypes.

2) Fix the Traversable instance.

3) Define the instances only for Serial stream types. Other streams cannot be
instantiated for Foldable monads.

4) Add test cases

5) add benchmarks
2018-11-19 12:13:33 +05:30
Harendra Kumar
c28043f48a Add pure stream (list) instances
Pure streams are streams with Identity as the base monad.
Added Eq/Ord/Read/Show/IsString/IsList instances for pure streams.
2018-11-16 14:39:26 +05:30
Harendra Kumar
bf4e5d89ec Add mixed ops x 2 and iterated benchmarks to base
Also, fix comparative graph generation, titles etc.
2018-11-06 03:12:08 +05:30
Harendra Kumar
c8aaba38cb Add dropWhileFalse/dropOne
Also, disable monadic versions of drop/take.  Pure versions use the monadic
ones internally so the monadic benchmarks are redundant unless we change the
implementations in future.
2018-10-31 16:50:00 +05:30
Harendra Kumar
b4f9c6912e Add benchmarks iterating the same op multiple times 2018-10-31 01:14:02 +05:30
Harendra Kumar
615197d1c5 split head and tail benchmarks from nullHeadTail 2018-10-29 13:19:59 +05:30
Harendra Kumar
819786eca9 Add transformation/filtering/mixed composition benchmarks 2018-10-29 00:21:16 +05:30
Harendra Kumar
bf39d27446 lint free benchmarks 2018-10-13 08:52:09 +05:30
Harendra Kumar
a929a1682c add linear-async, base streams benchmark reporting
split linear to separate serial and parallel modules. Parallel modules use
lower number of elements in the stream so that they can run faster.
2018-10-10 12:39:27 +05:30
Harendra Kumar
f09e741e04 Add benchmarks for maxRate, maxThreads and maxBuffer 2018-08-12 18:20:03 +05:30
Harendra Kumar
c39a442ddf Add benchmarks and tests for new operations
Also fix the signature of foldl1'
Add notes about state passing
2018-08-09 00:43:48 +05:30
Harendra Kumar
9fe6dc1726 use direct style zipWith and zipWithM 2018-06-27 09:10:39 +05:30
Harendra Kumar
6530e7634f push uncons/null/head/tail to StreamK
and implement direct versions of these as well.
2018-06-27 05:20:14 +05:30
Harendra Kumar
9b78a64f80 implement elem/notElem/all/any for StreamD 2018-06-27 01:04:26 +05:30
Harendra Kumar
c7d2f9e0a3 Add flag to switch stream backend to streamk 2018-06-26 09:44:06 +05:30
Harendra Kumar
beba8f7919 Use direct style filtering functions
Also, organized a lot of code, by reordering in a more logical order and made
it consistent across multiple streams types.
2018-06-26 06:00:47 +05:30
Harendra Kumar
5ace3582a8 use foldl' for length, sum, product 2018-06-25 03:51:02 +05:30
Harendra Kumar
de5c0ca22e use direct style scan, push mapMaybe from prelude to StreamK 2018-06-25 03:15:22 +05:30
Harendra Kumar
3ae953064d use folds and map from direct style stream 2018-06-24 22:43:30 +05:30
Harendra Kumar
7a526f22b9 use direct style streams for linear composition
For some stream generation APIs.
Also added, fromList/fromListM APIs.
2018-06-24 06:19:41 +05:30
Harendra Kumar
9c85811905 rename "once" to "yieldM"
and some other related refactoring changes.
2018-06-23 06:50:59 +05:30
Harendra Kumar
b77e76fd53 Add/rearrange INLINE pragmas on benchmarks 2018-06-18 02:56:52 +05:30
Harendra Kumar
b9e5e424a7 remove the append benchmark
it is already covered by the generation benchmarks
2018-06-13 17:46:54 +05:30
Harendra Kumar
aa4c8707b5 add more benchmarks, update benchmarks 2018-06-09 21:11:15 +05:30
Harendra Kumar
decdf72e3a use lower number of elements in benchmark stream
To enable parallel benchmarks
2018-06-03 00:28:14 +05:30
Harendra Kumar
2f706b9bfb add concurrent stream generation benchmarks 2018-05-28 11:35:33 +05:30
Harendra Kumar
669295965a Add some INLINABLE pragams 2018-05-27 10:33:21 +05:30
Harendra Kumar
9cb2ac0bb7 Add concurrent generation and transformation capabilities
- monadic stream generation functions are now concurrent
- monadic stream transformation (mapM, sequence) functions are now concurrent
- fixed a race which caused blockedindefinitely on MVar in rare cases
2018-05-24 16:48:48 +05:30
Harendra Kumar
3b6427818f Add fromFoldableM
Also,

- INLINE consM and once
- add benchmarking for various ways of sourcing (unfoldr(M), fromFoldable(M),
  foldMapWith serial)
2018-05-21 17:54:19 +05:30
Harendra Kumar
c8b32f2a53 Fix naming changes in benchmarks 2018-05-13 10:27:49 +05:30
Harendra Kumar
091f4b69fe Add the strictly parallel stream type ParallelT 2018-05-08 07:49:43 +05:30
Harendra Kumar
cf1388b330 Add append benchmark to linear benchmarks 2018-05-06 05:13:10 +05:30
Harendra Kumar
a526207acd rename the default stream type to StreamT
This was earlier changed from StreamT to SerialT. However we have made this the
default type now and it makes more sense to call it StreamT now. A bigger
motivation for the change is that StreamT immediately conveys that it is a
stream which is helpful and intuitive for new learners. Also we have a plan to
have a specialized type called "Stream a = StreamT IO a", so the name StreamT
is in line with that common default type "Stream a". Calling that type as
"Serial a" does not sound as intuitive as calling it "Stream a".
2018-04-25 11:31:12 +05:30
Harendra Kumar
ac39277da8 Rename benchmark modules 2018-04-25 11:28:47 +05:30