Commit Graph

100 Commits

Author SHA1 Message Date
Harendra Kumar
f0398ee8b6 Add benchmarking for fromParserK 2020-07-17 03:46:04 +05:30
Harendra Kumar
37f325e4b2 Add some more benchmarks for ParserK 2020-07-17 03:46:04 +05:30
Harendra Kumar
89b9e233ba Fix inspection tests 2020-07-09 17:40:27 +05:30
Harendra Kumar
bc6b4eed32 Reduce compile time mem util in Handle benchmarks
* Split into two modules
* Remove unnecessary INLINE pragmas
2020-07-09 17:40:27 +05:30
Harendra Kumar
0d586750a7 Add INLINE phase annotations on some functions 2020-07-09 16:10:24 +05:30
Harendra Kumar
53504dba3c Use smaller input files for longer benchmarks 2020-07-09 16:10:01 +05:30
Harendra Kumar
3d033ae915 Reorganize, move the FileIO benchmarks
Now they are in FileSystem.Handle module corresponding to the source module
with the same name. Also, now we have them arranged based on space complexity
so that we can apply RTS memory restrictions when running.

Also, now longer benchmarks use a shorter file.
2020-07-08 03:10:09 +05:30
pranaysashank
202f674462 Change the signature of foldlM' to use a monadic seed.
- Also change usages of foldlM' in tests and benchmarks.
2020-07-07 14:17:44 +05:30
Harendra Kumar
55d49bd50c Optimize Functor/Applicative/Monad etc for serial
Some of the benchmarks were order of magnitude off due to missing INLINE for
type class operations. Now, all of them are in reasonable limits. Benchmarks
affected for serial streams:

* Functor, Applicative, Monad, transformers

We need to do a similar exercise for other types of streams and for
folds/parsers as well.
2020-06-23 13:41:41 +05:30
Harendra Kumar
b4cef11d19 Add iterative benchmarks for Functor/transformers
* Also factor out the existing iteration utilities and use the same everywhere
2020-06-23 13:01:25 +05:30
Harendra Kumar
1a331cb402 Add more benchmarks for applicative/monad
Separate the applicative and monad benchmark groups
Complete benchmarks for all type class operations
2020-06-21 15:15:55 +05:30
Harendra Kumar
1cccb00101 Use foldrSShared instead of foldrS for Async
Because of not sharing the SVar foldrS performs poorly for Async streams and
has quadratic complexity.
2020-06-21 11:28:59 +05:30
Harendra Kumar
c0bd11de4b Elaborate concatMap, async benchmarks
* Add 3 interesting cases for each concatMap case
* For mapM, map concurrently on a serial stream so that we measure the
  concurrency overhead of mapM only and not both concurrent generation + mapM
* For Async streams add some benchmarks involving the `async` combinator.
* Add a benchmark for `foldrS`
2020-06-21 11:28:59 +05:30
Harendra Kumar
f9a7d24230 Fix perf regression in zip/zipM benchmarks 2020-06-08 18:52:06 +05:30
Harendra Kumar
294aa21417 Disable some broken benchmarks 2020-06-07 18:34:40 +05:30
Harendra Kumar
dc68afd167 Fix inspection testing 2020-06-07 10:27:58 +05:30
Harendra Kumar
129ebaf82c Refactor Prelude benchmarks
* Now benchmark modules correspond to source modules. The Prelude module in
  source corresponds to several modules one for each stream type.

* Benchmarks in the same order/groupings as they appear in source

* All benchmarks now have division according to space complexity

* Refactoring reduces a lot of code duplication especially the stream
  generation and elimination functions.

* The RTS options are now completely set in the shell script to run the
  benchmarks.

* RTS options can be set on a per benchmark basis. RTS options work correctly
  now.

* The set of streaming/infinite stream benchmarks is now complete and we can
  run all such benchmarks coneveniently.

* Benchmark "quick"/"speed" options can now be specified on a per benchmark
  basis. Longer benchmarks can have fewer iterations/quick run time.

* Benchmarks are grouped in several groups which can be run on a per group
  basis. Comparison groups are also defined for convenient comparisons of
  different modules (e.g. arrays or streamD/K).

* The benchmark namespaces are grouped in a consistent manner. Benchmark
  executables have a consistent naming based on module names.
2020-06-07 01:48:05 +05:30
Harendra Kumar
ed799d6b51 Fix unfold benchmark name, namespace, RTS options 2020-06-07 01:26:34 +05:30
Harendra Kumar
c2def514f9 Fix parser benchmark namespace and RTS options
Also, rename the benchmark modules to reflect source module hierarchy.
2020-06-07 01:26:34 +05:30
Harendra Kumar
0b83f5d445 Fix benchmark name space for fold benchmarks
Use Data.Fold/o-1-space/...
2020-06-07 01:17:43 +05:30
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