- Jul 26, 2023
-
-
Bodigrim authored
To measure performance of `someFunc` Haskell benchmarks often employ code like this: ```haskell map someFunc [1..1000] `deepseq` () ``` Here we want to measure time of 1000 applications of `someFunc`, and in order to do so we `deepseq` the entire list `map someFunc [1..1000]`. However, in this scenario we are not really interested in materializing the list: if `someFunc` is relatively fast, allocations are likely to skew measurements. See https://github.com/Bodigrim/tasty-bench/issues/48#issuecomment-1606049088 for discussion and various hacky workarounds. We can do better by making `instance NFData [a]` able to fuse by rewriting it via `foldr`. This has a nice side effect of avoiding manual recursion and having a more concise definition as well. Before the patch ```haskell foo :: Int -> () foo n = [1..n] `deepseq` () ``` compiles to ```haskell Rec { $wgo3 :: [Int] -> (# #) $wgo3 = \ (ds_s8hJ :: [Int]) -> case ds_s8hJ of { [] -> (##); : y_i8gZ ys_i8h0 -> case y_i8gZ of { I# ipv_i8gR -> $wgo3 ys_i8h0 } } end Rec } $wfoo :: Int# -> (# #) $wfoo = \ (ww_s8hT :: Int#) -> case ># 1# ww_s8hT of { __DEFAULT -> letrec { go3_a8hF :: Int# -> [Int] go3_a8hF = \ (x_a8hG :: Int#) -> : (I# x_a8hG) (case ==# x_a8hG ww_s8hT of { __DEFAULT -> go3_a8hF (+# x_a8hG 1#); 1# -> [] }); } in $wgo3 (go3_a8hF 1#); 1# -> (##) } foo :: Int -> () foo = \ (n_s8hR :: Int) -> case n_s8hR of { I# ww_s8hT -> case $wfoo ww_s8hT of { (# #) -> () } } ``` Here one can observe `$wgo3` which is forcing a list (essentially this is `rnf` from `instance NFData [a]`) and `go3_a8hF` which produces it. Such code allocates boxed `Int` and `(:)` constructors. After the patch: ```haskell foo :: Int -> () foo = \ (n_a8g8 :: Int) -> case n_a8g8 of { I# y_a8ha -> case ># 1# y_a8ha of { __DEFAULT -> joinrec { go3_a5N1 :: Int# -> () go3_a5N1 (x_a5N2 :: Int#) = case ==# x_a5N2 y_a8ha of { __DEFAULT -> jump go3_a5N1 (+# x_a5N2 1#); 1# -> () }; } in jump go3_a5N1 1#; 1# -> () } } ``` Here we do force evaluation of all elements of the list, but do not allocate them.
-
- Jan 29, 2023
-
-
Melanie Phoenix authored
-
- Jan 28, 2023
-
-
Melanie Phoenix authored
Addresses #93.
-
- Jan 24, 2023
-
-
Melanie Phoenix authored
-
Melanie Phoenix authored
-
Melanie Phoenix authored
-
Melanie Phoenix authored
-
Melanie Phoenix authored
-
Melanie Phoenix authored
-
- Jan 22, 2023
-
-
Melanie Phoenix authored
-
Melanie Phoenix authored
-
- Aug 26, 2022
-
-
Melanie Phoenix authored
add CPP to fix CI for 8.0.2 fix cpp for Type.Reflection
-
- Aug 18, 2022
-
-
Torsten Schmits authored
Part of the proposal https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst Tracked by ghc/ghc#21294
-
- Jun 19, 2022
-
-
Oleg Grenrus authored
Then we don't rely that heavily on simplifier to remove the GADT overhead. Even when unoptimized, there isn't additional box over RnfArgs1. I did similar change to hashable in 2019.
-
- May 04, 2022
-
-
Bodigrim authored
-
- Dec 05, 2021
-
-
Melanie Brown authored
-
- Dec 01, 2021
-
-
Bodigrim authored
-
- Nov 14, 2021
-
-
Melanie Brown authored
-
rebased onto unfck-version-history to remove 'infixr 0 `deepseq`'
-
Melanie Brown authored
- revert 'infixr 0 `deepseq`'
-
- Apr 14, 2021
-
-
Simon Jakobi authored
Corresponding MR for GHC: ghc/ghc!4945
-
- Aug 17, 2020
-
-
Simon Jakobi authored
Context: ghc/ghc!3388
-
- Jul 19, 2020
-
-
Martijn Bastiaan authored
-
- Jun 17, 2020
-
-
Simon Jakobi authored
Corresponding GHC MR: ghc/ghc!3388
-
- Jul 17, 2019
-
-
Ryan Scott authored
This fixes a handful of minor issues with the `NFData` instance for `URec`: * It had a `@since` annotation without Haddock formatting. * It did not mention that it was only available on `base-4.9` or later. * The CPP referred to `__GLASGOW_HASKELL__`, not `MIN_VERSION_base(4,9,0)` like it should have. This patch fixes all of these problems.
-
- Jun 24, 2019
-
-
- Sep 15, 2018
-
-
Herbert Valerio Riedel authored
...for the TypeRep/TypeCon instances
-
- Mar 20, 2018
-
-
Ryan Scott authored
-
- Mar 12, 2018
-
-
Ryan Scott authored
-
-
- Apr 22, 2017
-
-
Herbert Valerio Riedel authored
With the recent new API additions it makes sense to restructure a bit. Moreoever, this commit augments the new NFData1/NFData2 API with a few more haddock strings, and extends the introductory examples.
-
- Apr 16, 2017
-
-
Herbert Valerio Riedel authored
-
Herbert Valerio Riedel authored
This makes sure that the compiler has a better chance to warn/complain if we forget to update the BackDoor module when `base` changes
-
Herbert Valerio Riedel authored
This was made necessary by #28 This hack reduces the surface-area requiring TRUSTWORTHY annotations
-
- Apr 15, 2017
-
-
Herbert Valerio Riedel authored
...and add GHC 8.2.1 to CI matrix
-
-
- Apr 08, 2017
-
-
Ryan Scott authored
-
Ryan Scott authored
Plus some minor code cleanup
-
Pepe Iborra authored
-
- Feb 27, 2017
-
-
Pepe Iborra authored
-