You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Slow simulation is my single biggest pain point with CLaSH at the moment.
Could we do some work on improving the performance of Unsigned/Signed and Fixed? The former is phenomenally (40x) slower than Integer, and the latter is 3x slower than the former. If we could get down to Word64 speeds (four thousand times faster than Fixed) that would be absolutely fantastic.
Some sample code. Here is src/Profile2.hs:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MagicHash #-}
importCLaSH.PreludeimportGHC.Word (Word64)
importSystem.Environment (getArgs)
seven::Int
seven =7loop_Word64::Word64
loop_Word64 = go big 0where go n acc =if n <=0then acc
else acc `seq` go (n -1) (acc + n)
big =10^ seven
loop_Integer::Integer
loop_Integer = go big 0where go n acc =if n <=0then acc
else acc `seq` go (n -1) (acc + n)
big =10^ seven
loop_Unsigned::Unsigned64
loop_Unsigned= go big 0where go n acc =if n <=0then acc
else acc `seq` go (n -1) (acc + n)
big =10^ seven
loop_Fixed::FixedUnsigned640
loop_Fixed = go big 0where go n acc =if n <=0then acc
else acc `seq` go (n -1) (acc + n)
big =10^ seven
main =do
arg <-fmapPrelude.head getArgs
case arg of"Word64"->print loop_Word64
"Integer"->print loop_Integer
"Unsigned"->print loop_Unsigned
"Fixed"->print loop_Fixed
This is the output of running it
ghc -O2 -XDataKinds src/Profile2.hs && for i in Word64 Integer Unsigned
Fixed; do echo $i; time src/Profile2 $i; echo --; echo; done
Word64
50000005000000
real 0m0.004s
user 0m0.000s
sys 0m0.000s
--
Integer
50000005000000
real 0m0.156s
user 0m0.156s
sys 0m0.000s
--
Unsigned
50000005000000
real 0m6.364s
user 0m6.340s
sys 0m0.024s
--
Fixed
50000005000000.0
real 0m15.490s
user 0m15.460s
sys 0m0.036s
--
The text was updated successfully, but these errors were encountered:
Slow simulation is my single biggest pain point with CLaSH at the moment.
Could we do some work on improving the performance of Unsigned/Signed and Fixed? The former is phenomenally (40x) slower than Integer, and the latter is 3x slower than the former. If we could get down to Word64 speeds (four thousand times faster than Fixed) that would be absolutely fantastic.
Some sample code. Here is
src/Profile2.hs
:This is the output of running it
The text was updated successfully, but these errors were encountered: