storablevector-streamfusion
Conversion between storablevector and stream-fusion lists with fusion
This package brings together the best of two worlds:
The flexibility of plain lists and speed of low-level arrays.
Lists are lazy per element,
thus allowing for elegant tying-the-knot algorithms
and correct fusion of subsequent operations,
and they support any element type, including functions.
Storablevectors do not have these features.
Instead they are fast, including very fast access via indices,
they are memory efficient and allow simple exchange with C.
This package provides the canonical functions
for conversion from StorableVector to Stream and back.
By a simple fusion rule
they let the interim Stream based lists disappear in many situations,
resulting in fast low-level loops.
Such fusion could not be correct on StorableVectors.
E.g. consider
> import qualified Data.StorableVector.Lazy as SV
> SV.zipWith f (SV.unfoldr size g a) (SV.cons b (SV.unfoldr size h c))
which yields a storable vector with the chunk structure
> [1, size, size, ...]
and the following strictness behaviour:
For computation of the first value of the result,
the first chunk with size @size@ of @SV.unfoldr size g a@
has to be fully evaluated.
This has two advantages:
Firstly, you do not really want that behaviour,
but you accept it for the sake of overall performance.
Secondly, the odd behaviour cannot easily be preserved by fusion,
and we must resist to tell the optimizer incorrect rules.
So here is the solution: Write
> import qualified Data.StorableVector.Lazy.Stream as SVG
> import qualified Data.List.Stream as Stream
> SVG.from chunkSize $
> Stream.zipWith f
> (Stream.unfoldr g a)
> (Stream.cons b (Stream.unfoldr h c))
and get two advantages.
First: You do not have to pass the @size@ parameter at the leaves,
but only once at the top.
Second: Fusion jumps in and turns everything in a single efficient @SV.unfoldr@.
| version | uploaded | uploader | changes | |
|---|---|---|---|---|
| 0.0 | 2009-04-24 21:35 UTC | HenningThielemann | +410/−0 lines, 6 filesdep +basedep +binarydep +bytestringsetup-changed |
Dependencies of storablevector-streamfusion-0.0
base (>=1.0 && <2) && >=3 && (>=1.0 && <2) && >=3 4.22.0.0 → 4.22.1.0
| 2026-12-01 12:38 UTC | 4.22.1.0 outside bounds | +388/−6 lines, 9 filesdep ~ghc-internalPVP: major bump suggested |
| 2025-12-19 11:52 UTC | 4.22.0.0 outside bounds | +886/−215 lines, 28 filesdep ~ghc-internalPVP ok |
| 2026-03-27 12:26 UTC | 4.21.2.0 outside bounds | +10/−3 lines, 4 filesdep ~ghc-internalPVP ok |
| 2025-12-27 10:31 UTC | 4.21.1.0 outside bounds | +17/−5 lines, 4 filesdep ~ghc-internalPVP ok |
| 2024-12-16 09:24 UTC | 4.21.0.0 outside bounds | +1170/−396 lines, 39 filesdep ~ghc-internalPVP ok |
showing 5 of 61 versions
binary >=0.4 && <0.5 0.4.5 → 0.10.0.0 newer than bounds
| 2018-08-02 10:08 UTC | 0.10.0.0 newer than bounds | +504/−101 lines, 10 filesdep +generic-derivingdep −tardep ~Cabaldep ~QuickCheckPVP ok |
| 2017-03-13 22:00 UTC | 0.9.0.0 newer than bounds | +245/−690 lines, 15 filesdep +tardep −base-orphansdep −binarydep −generic-derivingdep ~Cabaldep ~QuickCheckdep ~basePVP ok |
| 2025-01-28 16:34 UTC | 0.8.9.3 newer than bounds | +8/−3 lines, 3 filesPVP ok |
| 2024-04-12 15:16 UTC | 0.8.9.2 newer than bounds | +23/−9 lines, 5 filesPVP: major bump suggested |
| 2022-08-04 23:02 UTC | 0.8.9.1 newer than bounds | +13/−12 lines, 3 filesPVP ok |
showing 5 of 50 versions
bytestring >=0.9 && <0.10 0.9.2.1 → 0.12.2.0 newer than bounds
| 2024-12-06 21:41 UTC | 0.12.2.0 newer than bounds | +538/−437 lines, 44 filesdep ~QuickCheckdep ~basePVP ok |
| 2024-02-16 03:27 UTC | 0.12.1.0 newer than bounds | +3398/−1642 lines, 37 filesdep +sybdep ~basePVP: major bump suggested |
| 2023-08-16 01:53 UTC | 0.12.0.2 newer than bounds | +16/−2 lines, 3 files |
| 2023-08-05 00:03 UTC | 0.12.0.1 newer than bounds | +47/−9 lines, 3 files |
| 2023-07-07 01:45 UTC | 0.12.0.0 newer than bounds | +1459/−520 lines, 21 filesdep +data-array-bytePVP ok |
showing 5 of 49 versions
old-time >=1.0 && <1.1 1.0.0.7 → 1.1.1.0 newer than bounds
| 2026-03-07 10:25 UTC | 1.1.1.0 newer than bounds | +495/−331 lines, 6 filesdep +old-timedep +tastydep +tasty-hunitdep ~basedep ~old-localenew-uploaderPVP ok |
| 2026-01-06 08:48 UTC | 1.1.0.5 newer than bounds | +18/−8 lines, 2 filesPVP ok |
| 2023-12-11 08:39 UTC | 1.1.0.4 newer than bounds | +4746/−4619 lines, 4 filesnew-uploaderPVP: major bump suggested |
| 2014-11-21 10:59 UTC | 1.1.0.3 newer than bounds | +50/−186 lines, 5 filesdep ~basesetup-changedPVP ok |
| 2014-03-22 09:43 UTC | 1.1.0.2 newer than bounds | +1128/−904 lines, 9 filesdep ~basedep ~old-localenew-uploaderPVP ok |
showing 5 of 14 versions
storablevector >=0.2 && <0.3 0.2.13.3 → 0.2.13.4
| 2026-06-05 21:22 UTC | 0.2.13.4 | +14/−43 lines, 5 filesdep ~basePVP ok |
| 2026-06-05 20:51 UTC | 0.2.13.3 | +5/−5 lines, 1 filesdep ~deepseqdep ~semigroupsPVP: major bump suggested |
| 2023-10-07 16:38 UTC | 0.2.13.2 | +18/−15 lines, 3 filesdep ~deepseqdep ~randomPVP ok |
| 2020-06-24 10:14 UTC | 0.2.13.1 | +7/−6 lines, 2 filesdep ~bytestringdep ~randomdep ~transformersPVP: major bump suggested |
| 2018-02-17 17:57 UTC | 0.2.13 | +25/−4 lines, 5 filesdep +semigroupsPVP ok |
showing 5 of 32 versions
stream-fusion >=0.1 && <0.2 0.1.2.4 → 0.1.2.5
| 2013-01-12 22:04 UTC | 0.1.2.5 | +15347/−15 lines, 47 filesPVP ok |
| 2012-10-05 17:20 UTC | 0.1.2.4 | +16/−15330 lines, 45 filesdep ~basenew-uploaderPVP: major bump suggested |
| 2011-05-22 18:57 UTC | 0.1.2.3 | +21/−22 lines, 5 filesdep ~basePVP ok |
| 2009-07-19 21:56 UTC | 0.1.2.2 | +5/−5 lines, 2 files |
| 2008-11-08 18:07 UTC | 0.1.2.1 | +53/−25 lines, 5 files |
showing 5 of 8 versions
utility-ht >=0.0.1 && <0.1 0.0.17.1 → 0.0.17.2
| 2024-07-06 11:48 UTC | 0.0.17.2 | +10/−18 lines, 4 filesPVP ok |
| 2024-02-07 23:12 UTC | 0.0.17.1 | +1076/−781 lines, 15 filesPVP ok |
| 2023-04-28 10:51 UTC | 0.0.17 | +100/−28 lines, 6 filesdep ~doctest-libPVP ok |
| 2021-03-14 18:35 UTC | 0.0.16 | +1685/−685 lines, 31 filesdep +doctest-exitcode-stdiodep +doctest-libPVP ok |
| 2020-03-21 14:58 UTC | 0.0.15 | +68/−22 lines, 8 filesPVP: major bump suggested |
showing 5 of 21 versions
Reverse dependencies
1 packages depend on storablevector-streamfusion