Commit Graph

80 Commits

Author SHA1 Message Date
Harendra Kumar
f72d007c51 Rename array benchmarks and prefixes by module names 2020-06-07 01:17:43 +05:30
Harendra Kumar
1c57096c3c Split "base" benchmark into per module benchmarks
Also, use module name prefix on the benchmarks.
2020-06-07 01:17:43 +05:30
adithyaov
ae7a0250cd Split lib/b/Prelude into Generation, Elimination and Transformation 2020-06-07 01:17:42 +05:30
adithyaov
cf8ec5cc91 Rename o_1_space_parallel* to o_n_space_parallel* 2020-06-07 01:09:26 +05:30
adithyaov
e7df8acee3 Merge all the base* executables 2020-06-07 01:09:26 +05:30
adithyaov
9abd8b84b6 Merge all the Serial/* benchmarks into Serial.hs 2020-06-07 01:09:26 +05:30
Harendra Kumar
01fa925af3 rename mconcatTo to sconcat 2020-05-31 01:46:01 +05:30
Harendra Kumar
07efcbd671 Add benchmark for classifySessionsOf 2020-05-28 19:16:01 +05:30
Harendra Kumar
aa25b34db0 Add benchmarks for *>, <*, split_, sequence_ 2020-05-11 21:25:24 +05:30
Harendra Kumar
2c9feb48ef Add YieldB (yield and backtrack) constructor
This fixes an issue in many/some/manyTill combinators.
2020-05-11 21:25:24 +05:30
Harendra Kumar
633c55eb31 rename splitParse/parseMany, concatParse/parseIterate 2020-05-11 21:18:09 +05:30
Harendra Kumar
684d2786eb Add concatParse to chain parsers on a stream
Add mconcatTo, update fold docs
Add fold docs/snippets using Monoids.
Add benchmark for sum using foldMap
Add concatParse benchmark
Add splitParseTill, update docs
2020-05-11 20:54:22 +05:30
Harendra Kumar
899cab5cd4 Make License Identifier SPDX compliant 2020-04-24 03:57:46 +05:30
Harendra Kumar
d7866f732d INLINE some/many implement *>/<*
Benchmarks that improved:

ParserK(cpuTime)
Benchmark                   default(0)(μs) default(1) - default(0)(%)
--------------------------- -------------- --------------------------
o-n-heap/parserK/sequenceA_       11183.17                     -32.75
o-n-heap/parserK/manyAlt          41514.00                     -40.82
o-n-heap/parserK/someAlt          68026.25                     -61.77
2020-04-24 02:59:40 +05:30
Harendra Kumar
dde9041833 Use parserK by default and rewrite to ParserD 2020-04-24 00:30:01 +05:30
Harendra Kumar
a03e2872a6 rename Parser module to ParserD
The top level module "Parser" will be using both ParserK and ParserD.
2020-04-24 00:30:01 +05:30
Harendra Kumar
12fef4390f Add a CPS style parser implementation
CPS performs much better for parsing operations like "sequence" and
"choice" on large containers. Given that applicative "sequence" does
not scale, I guess the Monad instance as well won't scale for direct
implementation.
2020-04-24 00:30:01 +05:30
Harendra Kumar
f51bbb25bd Rename some parsers and add some TBD and comments 2020-04-16 23:11:49 +05:30
Harendra Kumar
c8bbb0a1c8 Add lookAhead 2020-04-16 23:11:22 +05:30
Harendra Kumar
5f4de8630c add benchmark for takeWhile 2020-04-16 23:10:50 +05:30
Harendra Kumar
88e55f7051 Add Monad and MonadPlus instances 2020-04-16 21:15:02 +05:30
Harendra Kumar
fc24e44be1 fix ci to build benchmarks as well 2020-04-16 18:21:04 +05:30
Harendra Kumar
202c33d6e8 Add Alternative instance, combinators and parsers
parsers: peek, satisfy, eof, yield, yieldM, die, dieM
combinators: shortest, longest, alt, many, some, manyTill
2020-04-14 23:34:08 +05:30
Harendra Kumar
8921064283 Add teeWith - distribute input to 2 parsers
This is perhaps not an ideal implementation but something to play with.
2020-04-14 22:51:53 +05:30
Harendra Kumar
f6327e5b31 Use exceptions instead of Either return in extract
Also instead of returning wrapped state in "Stop" return type, return
the final extracted value.

  a) This makes a lot of code simpler because extract and error handling
     is not required at Stop.

  b) Not returning internal state indicates that the parse has ended and
     state is not supposed to be used from this point onwards.

  c) It may add a little complexity in the parser code as the parser has to
     extract the value from state at Stop.

  d) However, extract is still needed. But it is only needed if the fold
     remains partial when the stream stops. In such case we may have to
     use exception handling to detect error, and to distinguish the parse
     errors from any other types of errors. But since this is not common
     case it does not come in the fast path.

Note that we could remove extract altogether but that means we will have to
store the intermediate fold values in the driver loop which impacts
performance.
2020-04-14 22:51:53 +05:30
Harendra Kumar
f1eb9a18c2 rename parseChunks to splitParse 2020-04-09 04:19:00 +05:30
Harendra Kumar
b9c461f7b9 rename some parsers, add some parsers
rename endOn etc to sepBy etc.
add sepByMax
add unimplemented skeletons for wordBy, groupBy
2020-04-09 04:19:00 +05:30
Harendra Kumar
94459757dd Fix dates/typo/Functor instance 2020-04-09 04:06:57 +05:30
Harendra Kumar
136bf79bab Rename Parse type and Step constructors
Parse => Parser
Keep => Yield
Back => Skip
2020-04-09 04:06:57 +05:30
Harendra Kumar
cc8cd01bfe Simplify the Parse type
* Return the unused count in Halt instead of in extract.
* Use "Back 0" instead of "Hold"

Performance seems equivalent with these changes.
2020-04-09 04:06:57 +05:30
Harendra Kumar
df633139c2 Move benchmark code for parsers to its own module 2020-04-09 04:06:57 +05:30
Harendra Kumar
2723c15d36 Implement stream parsing
This is the initial version of stream parsing. It implements a "Parse"
type, some parsers based on that type, applicative composition, operations to
run parsers (parse) and to run parsers over chunks of a stream (parseChunks).

Parsers are just an extension of Folds in Streamly.Data.Fold. Parsers just add
backtracking and failure capabilities to folds.

Operations like splitOn to split a stream on a predicate can now be expressed
using a parser applied repeatedly on a stream. For example, line splitting can
be done using parsers. Parsers are as fast as fastest custom code for
line splitting.
2020-04-09 04:06:57 +05:30
adithyaov
633e88f8c5 Move unfold benchmarks out of prelude. Make a seperate exec. 2020-04-08 19:38:33 +05:30
adithyaov
24e481c00a Mv multiple modules from b/ to b/Streamly/Benchmark/Prelude
benchmark/Adaptive.hs -> benchmark/Streamly/Benchmark/Prelude/Adaptive.hs
benchmark/Concurrent.hs -> benchmark/Streamly/Benchmark/Prelude/Concurrent.hs
benchmark/LinearAsync.hs -> benchmark/Streamly/Benchmark/Prelude/LinearAsync.hs
benchmark/LinearRate.hs -> benchmark/Streamly/Benchmark/Prelude/LinearRate.hs
benchmark/NestedConcurrent.hs -> benchmark/Streamly/Benchmark/Prelude/NestedConcurrent.hs
benchmark/Parallel.hs -> benchmark/Streamly/Benchmark/Prelude/Parallel.hs
2020-04-08 19:38:33 +05:30
adithyaov
18949ef414 Move b/NestedOps.hs and b/NestedUnfoldOps.hs to b/Streamly/Benchmark 2020-04-08 19:38:33 +05:30
adithyaov
82e19d6cea Move benchmark/Array* to benchmark/Streamly/Benchmark/Memory/* 2020-04-08 19:38:33 +05:30
adithyaov
9797d7615d Make a sandalone fold executable. 2020-03-29 18:40:51 +05:30
adithyaov
18c903f5c4 Seperate folds from Prelude in benchmarks. 2020-03-18 11:31:01 +05:30
Harendra Kumar
5e1736c4f1 Comment out foldlS benchmark
It takes too much time, holding up benchmarking for too long.
2020-02-28 21:20:37 +05:30
Harendra Kumar
e76546fbb1 format some parts of the benchmarking code 2020-02-28 19:58:06 +05:30
adithyaov
b62c02f44a Merge O_n_Stack.hs into Prelude.hs
* Benchmark/Prelude/Serial/O_n_Stack ->
  lib/Streamly/Benchmark/Prelude.hs
* Modify O_n_Stack.hs accordingly
2020-02-28 19:58:06 +05:30
adithyaov
69a81af68d Merge O_n_Heap.hs into Prelude.hs
* Benchmark/Prelude/Serial/O_n_Heap ->
  lib/Streamly/Benchmark/Prelude.hs
* Modify O_n_Heap.hs accordingly
2020-02-28 19:58:06 +05:30
adithyaov
8544b1f1e7 Merge O_n_Space.hs into Prelude.hs
* Benchmark/Prelude/Serial/O_n_Space ->
  lib/Streamly/Benchmark/Prelude.hs
* Modify O_n_Space.hs accordingly
2020-02-28 19:58:06 +05:30
adithyaov
4d59cb3afe Merge lib/B/Groups.hs into lib/B/Prelude.hs
* Remove lib/B/Group.hs
* The idea: Have all the groups in Prelude and
  export only the groups, that way, all the functions
  aren't compiled multiple times (without and with
  inlining).
2020-02-28 19:58:06 +05:30
adithyaov
2dacf99488 Move and split benchmarks from O_1_Space.hs to Groups.hs
* Streamly/Benchmark/Prelude/O_1_Space.hs ->
lib/Streamly/Benchmark/Groups.hs

* Modify O_1_Space.hs accordingly
2020-02-28 19:58:06 +05:30
Harendra Kumar
eccf24a4b1 Add singletonM, update some docs 2020-02-26 13:44:25 +05:30
Harendra Kumar
166bd93267 refactor "base" stream benchmarks
push the benchmark definitions from the top level "BaseStreams.hs" file to the
individual stream modules to improve modularity.
2020-02-21 16:32:46 +05:30
Harendra Kumar
ae30f2fc9e classify "base" stream benchmarks by space usage 2020-02-21 16:32:46 +05:30
Harendra Kumar
7ce2dc87ea merge nested and nested-unfold benchmarks with others
merge them with other serial stream benchmarks.
2020-02-21 16:32:46 +05:30
Harendra Kumar
0b00efe4f6 Reorganize benchmark modules
* move common modules to lib directory. This is required because otherwise
  cabal/ghc would try to use them directly and emit warnings about
  missing-modules.

* move the prelude benchmark executables to Streamly/Benchmark/Prelude
  to be consistent with the organization of other modules.
2020-02-21 16:32:46 +05:30