Skip to content

Instantly share code, notes, and snippets.

@supergrade
supergrade / gist:9d55ae353a6d15dad4f5
Created February 26, 2015 19:03
Seq.initInfinite weird performance impact on Async code
open Microsoft.FSharp.Control
(*
Trying to isolate something I've seen in production code, the mere presence of Seq.initInfinite
Inside of parallel/async code is causing weird slowdowns and full lockups.
The code below doesn't fully lock up but slows down drastically when the Seq.initInfinite-bearing line is subbed in.
Code commented LINE X being in slows the simulation and the UI update dramatically.
If this line is removed, the simulation is fast
myDivide :: Double -> Double -> Maybe Double
myDivide a b =
let d = a / b -- d is bound - but b *could* be zero
-- if b is zero, 'divide by zero', d does not crash; but is bottom
in
case b of
0 -> Nothing
_ -> Just d
C:\t\idris-cil>stack --version
Version 1.4.1, Git revision eb243b99985d2d2e102075d91beb61014da55089 (4730 c
ts) x86_64
Compiled with:
- Cabal-1.24.2.0
- Glob-0.7.14
- HUnit-1.5.0.0
- MonadRandom-0.5.1
- QuickCheck-2.9.2
- SHA-1.6.4.2
C:\t\idris-cil>stack build idris
idris-0.99: configure (lib + exe)
Package idris uses a custom Cabal build, but does not use a custom-setup stanza
Not using the explicit setup deps approach based on configuration
Strongly recommend fixing the package's cabal file
Configuring idris-0.99...
make: rawSystem: does not exist (No such file or directory)
-- While building package idris-0.99 using:
C:\t\idris-cil\.stack-work\downloaded\ILugaAamj5ea\.stack-work\dist\b7fec0