summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-13 22:43:34 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-13 22:43:34 -0400
commitfd49dce7ad1d0a3f84ae267eb15939c1fa588b31 (patch)
tree997254794a15c097598b784e69e812075e8a583b
parentf6e0cf35a9e827def683cbe0bd0cfb3c708bcdc2 (diff)
downloadkeysafe-fd49dce7ad1d0a3f84ae267eb15939c1fa588b31.tar.gz
another benchamrk
-rw-r--r--Benchmark.hs5
-rw-r--r--Types/Cost.hs2
2 files changed, 5 insertions, 2 deletions
diff --git a/Benchmark.hs b/Benchmark.hs
index a46e9f4..815053c 100644
--- a/Benchmark.hs
+++ b/Benchmark.hs
@@ -82,7 +82,7 @@ benchmarkPoW rounds seconds = do
let Just mk = mkProofOfWorkRequirement seconds
s <- newRequestIDSecret
rid <- mkRequestID s
- benchmark rounds (CPUCost (seconds * Seconds (fromIntegral rounds)) (Divisibility 1))
+ benchmark rounds (CPUCost (seconds * fromIntegral rounds)) (Divisibility 1))
(return . genProofOfWork (mk rid))
benchmarkTunables :: Tunables -> IO ()
@@ -90,6 +90,9 @@ benchmarkTunables tunables = do
putStrLn "/proc/cpuinfo:"
putStrLn =<< readFile "/proc/cpuinfo"
+ putStrLn "Benchmarking 1 round of maximum size proof of work..."
+ print =<< benchmarkPoW 1 (maxProofOfWork / 2)
+
putStrLn "Benchmarking 1000 rounds of proof of work hash..."
print =<< benchmarkExpensiveHash 1000 (proofOfWorkHashTunable 0)
diff --git a/Types/Cost.hs b/Types/Cost.hs
index 4b71116..474db43 100644
--- a/Types/Cost.hs
+++ b/Types/Cost.hs
@@ -14,7 +14,7 @@ data Cost op
deriving (Show, Eq, Ord)
newtype Seconds = Seconds Rational
- deriving (Num, Eq, Ord, Show)
+ deriving (Num, Fractional, Eq, Ord, Show)
-- | How many CPU cores a single run of an operation can be divided amoung.
newtype Divisibility = Divisibility Integer