diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-01-12 13:22:31 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-01-12 13:22:31 -0400 |
commit | 6dce01324f7bbc0085628cbe08e6ad9d63fcc7de (patch) | |
tree | 5092d2e3f4c562f4b916cc75b13e0b442a298425 | |
parent | b8f03df07060daba1636ee41a20bd8438badc331 (diff) |
add benchmarks of adding an associated file
benchmarking keys database/addAssociatedFile to 1000 (old)
time 516.1 μs (514.7 μs .. 517.4 μs)
1.000 R² (1.000 R² .. 1.000 R²)
mean 514.0 μs (512.1 μs .. 515.2 μs)
std dev 4.740 μs (2.972 μs .. 7.068 μs)
benchmarking keys database/addAssociatedFile to 1000 (new)
time 5.750 ms (4.857 ms .. 6.885 ms)
0.815 R² (0.698 R² .. 0.904 R²)
mean 7.858 ms (7.311 ms .. 8.421 ms)
std dev 1.684 ms (1.383 ms .. 2.027 ms)
variance introduced by outliers: 88% (severely inflated)
benchmarking keys database/addAssociatedFile to 10000 (old)
time 515.7 μs (514.8 μs .. 516.5 μs)
1.000 R² (1.000 R² .. 1.000 R²)
mean 515.4 μs (513.7 μs .. 516.6 μs)
std dev 4.824 μs (2.957 μs .. 7.167 μs)
benchmarking keys database/addAssociatedFile to 10000 (new)
time 8.934 ms (7.779 ms .. 10.05 ms)
0.868 R² (0.751 R² .. 0.934 R²)
mean 11.51 ms (10.66 ms .. 12.26 ms)
std dev 2.174 ms (1.816 ms .. 2.747 ms)
variance introduced by outliers: 82% (severely inflated)
-rw-r--r-- | Command/Benchmark.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Command/Benchmark.hs b/Command/Benchmark.hs index 66af1f98c..b1cc9a830 100644 --- a/Command/Benchmark.hs +++ b/Command/Benchmark.hs @@ -47,6 +47,8 @@ benchmark _ = withTmpDirIn "." "benchmark" $ \tmpdir -> do , getAssociatedFilesMissBench db , getAssociatedKeyHitBench db , getAssociatedKeyMissBench db + , addAssociatedFileOldBench db + , addAssociatedFileNewBench db ] getAssociatedFilesHitBench :: BenchDb -> Benchmark @@ -67,6 +69,18 @@ getAssociatedKeyMissBench :: BenchDb -> Benchmark getAssociatedKeyMissBench (BenchDb h num) = bench ("getAssociatedKey from " ++ show num ++ " (miss)") $ nfIO $ SQL.getAssociatedKey fileMiss (SQL.ReadHandle h) +addAssociatedFileOldBench :: BenchDb -> Benchmark +addAssociatedFileOldBench ( BenchDb h num) = bench ("addAssociatedFile to " ++ show num ++ " (old)") $ nfIO $ do + n <- getStdRandom (randomR (1,num)) + SQL.addAssociatedFile (keyN n) (fileN n) (SQL.WriteHandle h) + H.flushDbQueue h + +addAssociatedFileNewBench :: BenchDb -> Benchmark +addAssociatedFileNewBench ( BenchDb h num) = bench ("addAssociatedFile to " ++ show num ++ " (new)") $ nfIO $ do + n <- getStdRandom (randomR (1,num)) + SQL.addAssociatedFile (keyN n) (fileN (n+1)) (SQL.WriteHandle h) + H.flushDbQueue h + populateAssociatedFiles :: H.DbQueue -> Int -> IO () populateAssociatedFiles h num = do forM_ [1..num] $ \n -> |