Commit Graph

169 Commits

Author SHA1 Message Date
Harendra Kumar
0ef35be05b Add inspection tests for some benchmarks (eq/cmp/merge/zip) 2019-08-23 17:43:00 +05:30
Harendra Kumar
11b10b9c0c Move LinearOps.hs benchmark file to streamly library
To facilitate inspection testing of all benchmarks.
2019-08-23 14:57:29 +05:30
Harendra Kumar
17b7d92941 correct test description 2019-08-23 06:27:51 +05:30
Harendra Kumar
120175cb64 Add inspection testing for fileio benchmarks 2019-08-20 08:19:49 +05:30
Harendra Kumar
da29139f45 Use Unfold to read and concat arrays efficiently
The performance is similar to flattenArrays, the code fuses perfectly. But in
the linecount benchmark Unfold case performs 50% slower even though this is not
due to fusion, just less optimal code being generated.
2019-08-19 13:33:24 +05:30
Harendra Kumar
3b0f6df5cf Add an unfold type to compose streams with better fusion 2019-08-17 14:04:06 +05:30
Harendra Kumar
1bfca9e46c merge the ArrayStream module to Array module itself
Each container type (e.g. Handle/Socket/File) may have similar nested/stream
level operations. We need a standardized way of naming the combinators related
to streams of containers.  Also, we cannot have a separate module for such
combinators for each container type. Therefore it makes sense to put them in
the same module.
2019-08-17 05:13:48 +05:30
Pranay Sashank
d26ab21364 Move Streamly.String to Streamly.Data.String. 2019-08-13 13:09:22 +05:30
Pranay Sashank
5b801ab335 Flip the arguments order to foldLines and foldWords. 2019-08-12 09:53:01 +05:30
Harendra Kumar
479d731b24 Add writeS to fileio benchmarks 2019-08-12 07:13:26 +05:30
Harendra Kumar
06b0cb1328 Implement IO write operations as folds. 2019-08-12 07:13:26 +05:30
Harendra Kumar
3d32be5acc Add array benchmarks to charting/comparisons 2019-08-12 07:13:26 +05:30
Harendra Kumar
1e6b3b6261 Expose hidden Prelude APIs via Streamly.Internal module 2019-08-07 03:44:02 +05:30
Harendra Kumar
27d7ea8f30 expose the experimental Fold APIs via internal module 2019-08-07 03:42:56 +05:30
Pranay Sashank
07e954820d Refactor readArraysOfUpto to readArraysOf in Socket, Handle, File.
- And also in examples, benchmarking code.
2019-08-07 00:22:26 +05:30
Pranay Sashank
bda6a6415b Refactor modules Mem.* ~> Memory.* and update references. 2019-08-06 04:31:23 +05:30
Harendra Kumar
2438be4259 rename the Mem.Array.Stream module to Mem.ArrayStream 2019-08-06 02:55:06 +05:30
Harendra Kumar
e621237b79 update documentation and rename toArray => write
rename toArray/toArrayN to writeF/writeNF to keep the API name consistent with
their regular counterparts. Now the only difference in fold APIs is a suffix F.
2019-08-06 02:28:14 +05:30
Harendra Kumar
a740d4dba9 move stream transformation operations to Prelude 2019-08-03 23:15:26 +05:30
Harendra Kumar
3cdecba40c Create a separate module for "Streams of Arrays" 2019-08-03 08:16:23 +05:30
Harendra Kumar
196b4de2ed hide benchmarks for hidden combinators 2019-08-03 05:16:59 +05:30
Pranay Sashank
f8afec67f4 Comment out benchmarking code for pipes ops. 2019-07-30 15:05:24 +05:30
Harendra Kumar
687fb9a283 Add "flatten" to StreamD as a faster alternative to concatMap 2019-07-28 06:43:51 +05:30
Harendra Kumar
8552589390 Add more concatMap benchmarks
* concat pure streams
* concat n x n
* use replicate with concatMap
2019-07-26 19:18:00 +05:30
Harendra Kumar
b67b840556 Add config options to run benchmarks quickly 2019-06-28 03:16:46 +05:30
Harendra Kumar
d6eb138165 Add concat/append benchmark for concurrent streams
Measure space usage in interesting cases.

The motivation for these benchmarks is parallel stream consuming a lot of stack
space in concatMap case. These benchmarks will hopefully catch any such
problems in future.

These benchmarks may take a lot of time to allow memory consumption to slowly
buildup to noticeable amount in case there is a problem. Therefore they are
enabled only in dev builds. We can use `--include-first-iter`, `--min-duration
0` options in gauge to run them in reasonable time. They need to be run with
`--measure-with` option to allow isolated runs, otherwise memory measurement
won't be correct.
2019-06-28 02:54:35 +05:30
Harendra Kumar
50170f39a5 Add fileio benchmark 2019-06-18 23:39:15 +05:30
Harendra Kumar
773f5a7c70 Fix a bug that caused reopening of the wrong file 2019-06-18 16:19:00 +05:30
Harendra Kumar
b846fd6a21 Allow older versions of deepseq
Otherwise cabal cannot find a build plan for older versions of GHC
2019-06-16 19:39:46 +05:30
Harendra Kumar
a8051edf7a Add cat and wc -l to benchmarks 2019-06-16 19:39:37 +05:30
Harendra Kumar
213ac6bc98 use the same test file for all benchmarks 2019-06-16 19:39:26 +05:30
Harendra Kumar
dbaacea1c6 implement fromStreamDArraysOf more efficiently
The implementation of fromStreamDArraysOf is now 3x more efficient compared to
the earlier implementation. This makes byte stream level operations almost as
efficient as array level operations.

Other than this the following changes are added in this commit:
* Add insertAfterEach
* Add writeArraysPackedUpto to Handle IO
* Implement `wc -l` example more efficiently using arrays
* Add benchmark for lines/unlines using arrays
* Add tests for splitArraysOn
* Rename some array/file/handle APIs
* Error handling when the group size in grouping operations is 0 or negative
2019-06-15 19:01:09 +05:30
Harendra Kumar
694eab4e6a Raw IO w/o buffering, add some array APIs
* Streamly.FileSystem.FD module for unbuffered IO. Buffering can be controlled
  from the stream itself.
* Support IO using writev as well

Array APIs include:

* coalesceChunksOf to coalesce smaller arrays in a stream into bigger ones
* unlinesArraysBy to join a stream of arrays using a line separator
* splitArraysOn to split a stream of arrays on a separator byte
2019-06-15 19:01:09 +05:30
Pranay Sashank
2255dacd3e Add benchmarking code for lines/unlines, decode/encode. 2019-06-12 10:38:55 +05:30
Pranay Sashank
d4bef2e352 Add intersperse to Streamly.Prelude.
- Also adds benchmarking code for intersperse.
2019-06-12 10:30:15 +05:30
Harendra Kumar
98d225672d Rename merge to tee 2019-06-07 09:34:23 +05:30
Harendra Kumar
517c3b7a23 Implement a 'Pipe' type 2019-06-07 09:34:23 +05:30
Pranay Sashank
218b48a1a3 Add benchmarks for fromIndices and fromIndicesM. 2019-06-01 22:00:04 +05:30
Harendra Kumar
606fe9de74 rename FileSystem.File module to FileSystem.Handle 2019-05-30 08:31:24 +05:30
Harendra Kumar
1949eb90af Concurrent concatMap, foldr/build fusion, benchmarks
* Implement a stream flavor specific (concurrent/wSerial etc.) concatMap
  (concatMapBy). Now concatMap has the same capabilities that the monad bind of
  different streams has. In fact the monad bind is implemented using concatMap

* Use foldr/build fusion for concatMap (currently disabled) and for map/fmap
  and mapM (enabled)

* Add benchmarks for bind/concatMap performance
2019-05-27 23:29:21 +05:30
Harendra Kumar
50232af000 rename/reorg/remove some fold APIs
rename groupsOf to chunksOf
remove grouped as it is just another version of splitSuffixBy'
reorganize sections
Add some docs/notes
2019-05-20 00:57:16 +05:30
Harendra Kumar
8bcbc77e62 rename Streamly.Array to Streamly.Mem.Array 2019-05-15 20:41:45 +05:30
Harendra Kumar
38c5c8872c Add File IO support 2019-05-15 17:54:12 +05:30
Harendra Kumar
7336d585a9 Fix a bug caused by unsafeInlineIO
unsafe use of unsafeInlineIO caused each array allocated in the toArrayN fold
to share the same memory.

This fix uses the IO monad to make sure that the code is not pure and therefore
we always allocate new memory. All such usage of unsafePerformIo have been
fixed. The remaining ones are reviewed to be safe.
2019-05-13 12:21:16 +05:30
Harendra Kumar
fd7bd713ec Add "Streamly.Fold" module 2019-05-13 12:21:16 +05:30
Harendra Kumar
36c4c4ca7b Add Streamly.Array module
* Supports fixed size immutable arrays
* See the module documentations for details.
2019-05-13 12:21:16 +05:30
Harendra Kumar
db2c560a65 add direct versions of monolithic scan/map and fold/map
After perf measurement these seems to perform the same as a scan followed by
map therefore we have not exposed these but kept for perf comparison and just
in case use.

* Deprecate `scanx`, `foldx`, `foldxM`
* Remove deprecated APIs `scan`, `foldl`, `foldlM`
2019-05-04 15:35:55 +05:30
Harendra Kumar
f1670f31ce Move some functions from Streamly to Streamly.Prelude
* `runStream`, `foldWith`, `foldMapWith`, `forEachWith` have been moved from
  "Streamly" module to "Streamly.Prelude" module.
2019-05-04 02:42:38 +05:30
Harendra Kumar
0ce4a6d5ad Fix right fold, document folds, add generic folds
* Fix the signature of foldrM
* Implement some custom folds in terms of foldr
* Document folds and scans better
* Reorganize the documentation in Prelude
* Add foldrS and foldrT for transforming folds
* add toRevList
* Add benchmarks and tests for the new folds
2019-05-03 16:46:43 +05:30
Harendra Kumar
7d577a469b Add detailed benchmarks for folds
INLINE foldlM'
2018-12-29 21:10:02 +05:30