File: SmoothNumbersBench.hs

package info (click to toggle)
haskell-arithmoi 0.13.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 964 kB
  • sloc: haskell: 10,379; makefile: 3
file content (20 lines) | stat: -rw-r--r-- 517 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# OPTIONS_GHC -fno-warn-type-defaults #-}

module Math.NumberTheory.SmoothNumbersBench
  ( benchSuite
  ) where

import Test.Tasty.Bench

import Math.NumberTheory.Primes
import Math.NumberTheory.SmoothNumbers

doBench :: Int -> Int
doBench lim = sum $ take lim $ smoothOver $ fromList $ map unPrime [nextPrime 2 .. precPrime lim]

benchSuite :: Benchmark
benchSuite = bgroup "SmoothNumbers"
  [ bench "100"      $ nf doBench   100
  , bench "1000"     $ nf doBench  1000
  , bench "10000"    $ nf doBench 10000
  ]