aboutsummaryrefslogtreecommitdiff
path: root/bench/Main.hs
blob: d8582fe2c37bb0f11b4912e2a4585d7950bf8eaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE TypeApplications #-}
module Main where

import Test.Tasty.Bench

import Data.Array.Nested


main :: IO ()
main = defaultMain
  [bgroup "Num"
    [bench "sum(+) Double [1e6]" $
      let n = 1_000_000
      in nf (\(a, b) -> runScalar (rsumOuter1 (a + b)))
            (riota @Double n, riota n)
    ,bench "sum(*) Double [1e6]" $
      let n = 1_000_000
      in nf (\(a, b) -> runScalar (rsumOuter1 (a + b)))
            (riota @Double n, riota n)]]