-
-
Save Shimuuar/82df518aee412de92bc48487945aea7b to your computer and use it in GitHub Desktop.
summation performace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kbn | |
kb2 | |
*.hi | |
*.o | |
*.data | |
TAGS | |
naive | |
onlygen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE NumDecimals #-} | |
import qualified Data.Vector.Unboxed as U | |
import qualified Numeric.Sum as Sum | |
import qualified System.Random.MWC as MWC | |
main :: IO () | |
main = do | |
g <- MWC.create | |
vec <- MWC.uniformVector g 1e8 | |
print $ Sum.sumVector Sum.kb2 (vec :: U.Vector Double) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE NumDecimals #-} | |
import qualified Data.Vector.Unboxed as U | |
import qualified Numeric.Sum as Sum | |
import qualified System.Random.MWC as MWC | |
main :: IO () | |
main = do | |
g <- MWC.create | |
vec <- MWC.uniformVector g 1e8 | |
print $ Sum.sumVector Sum.kbn (vec :: U.Vector Double) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: all clean report | |
all: naive kb2 kbn onlygen | |
report: naive.data kb2.data kbn.data onlygen.data | |
clean: | |
rm -rfv kbn naive kb2 onlygen *.o *.hi *.data *.old | |
%: %.hs | |
ghc -g --make -O2 $< | |
%.data: % | |
rm -f $@ | |
perf record -o $@ ./$< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE NumDecimals #-} | |
import qualified Data.Vector.Unboxed as U | |
import qualified Numeric.Sum as Sum | |
import qualified System.Random.MWC as MWC | |
main :: IO () | |
main = do | |
g <- MWC.create | |
vec <- MWC.uniformVector g 1e8 | |
print $ U.sum (vec :: U.Vector Double) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE NumDecimals #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
import qualified Data.Vector.Unboxed as U | |
import qualified Numeric.Sum as Sum | |
import qualified System.Random.MWC as MWC | |
main :: IO () | |
main = do | |
g <- MWC.create | |
vec :: U.Vector Double <- MWC.uniformVector g 1e8 | |
return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment