benchmark: Add --databases to benchmark sqlite databases

Rescued from commit 11d6e2e260 which removed
db benchmarks in favor of benchmarking arbitrary git-annex commands. Which
is nice and general, but microbenchmarks are useful too.
This commit is contained in:
Joey Hess 2019-10-29 15:16:15 -04:00
parent 25f912de5b
commit e1b21a0491
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -64,13 +64,11 @@ getAssociatedFilesMissBench (BenchDb h num) = bench ("getAssociatedFiles from "
getAssociatedKeyHitBench :: BenchDb -> Benchmark
getAssociatedKeyHitBench (BenchDb h num) = bench ("getAssociatedKey from " ++ show num ++ " (hit)") $ nfIO $ do
n <- getStdRandom (randomR (1,num))
-- fromIKey because this ends up being used to get a Key
map fromIKey <$> SQL.getAssociatedKey (fileN n) (SQL.ReadHandle h)
SQL.getAssociatedKey (fileN n) (SQL.ReadHandle h)
getAssociatedKeyMissBench :: BenchDb -> Benchmark
getAssociatedKeyMissBench (BenchDb h num) = bench ("getAssociatedKey from " ++ show num ++ " (miss)") $ nfIO $
-- fromIKey because this ends up being used to get a Key
map fromIKey <$> SQL.getAssociatedKey fileMiss (SQL.ReadHandle h)
SQL.getAssociatedKey fileMiss (SQL.ReadHandle h)
addAssociatedFileOldBench :: BenchDb -> Benchmark
addAssociatedFileOldBench (BenchDb h num) = bench ("addAssociatedFile to " ++ show num ++ " (old)") $ nfIO $ do