{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoStarIsType #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}
module Crypto.Lol.Applications.Benchmarks.Default
( defaultBGVBenches
, defaultKHPRFBenches
) where
import Control.DeepSeq (NFData)
import Crypto.Lol
import Crypto.Lol.Applications.Benchmarks.KHPRFBenches
import Crypto.Lol.Applications.Benchmarks.BGVBenches
import Crypto.Lol.Benchmarks (type (**),
Benchmark, Zq,
bgroup)
defaultBGVBenches :: (forall m r . (Fact m, NFData r) => NFData (t m r), _)
=> Proxy t -> Proxy gad -> Proxy gen -> rnd [Benchmark]
defaultBGVBenches pt pgad pgen = sequence [
fmap (bgroup "BGV") $ sequence $ ($ pt) . ($ pgen) <$>
[bgvBenches (Proxy::Proxy '(F16, F1024, Zq 8, Zq 1017857)),
bgvBenches (Proxy::Proxy '(F16, F2048, Zq 16, Zq 1017857))],
fmap (bgroup "Dec") $ sequence $ ($ pt) <$>
[decBenches (Proxy::Proxy '(F16, F1024, Zq 8, Zq 1017857)),
decBenches (Proxy::Proxy '(F16, F2048, Zq 16, Zq 1017857))],
fmap (bgroup "Rescale") $ sequence $ ($ pt) <$>
[rescaleBenches (Proxy::Proxy '(F32, F2048, Zq 16, Zq 1017857, Zq (1032193 ** 1017857))),
rescaleBenches (Proxy::Proxy '(F32, F64*F9*F25, Zq 16, Zq 1008001, Zq (1065601 ** 1008001)))],
fmap (bgroup "KeySwitch") $ sequence $ ($ pt) . ($ pgad) <$>
[keySwitchBenches (Proxy::Proxy '(F32, F2048, Zq 16, Zq (1017857 ** 1032193))),
keySwitchBenches (Proxy::Proxy '(F32, F64*F9*F25, Zq 16, Zq (1008001 ** 1065601)))],
fmap (bgroup "Tunnel") $ sequence $ ($ pt) . ($ pgad) <$>
[tunnelBenches (Proxy::Proxy '(F128,
F128 * F7 * F13,
F64 * F7, F64 * F7 * F13,
Zq PP32,
Zq 3144961)),
tunnelBenches (Proxy::Proxy '(F64 * F7,
F64 * F7 * F13,
F32 * F7 * F13,
F32 * F7 * F13,
Zq PP32,
Zq 3144961)),
tunnelBenches (Proxy::Proxy '(F32 * F7 * F13,
F32 * F7 * F13,
F8 * F5 * F7 * F13,
F8 * F5 * F7 *F13,
Zq PP32,
Zq 3144961)),
tunnelBenches (Proxy::Proxy '(F8 * F5 * F7 * F13,
F8 * F5 * F7 *F13,
F4 * F3 * F5 * F7 * F13,
F4 * F3 * F5 * F7 * F13,
Zq PP32,
Zq 3144961)),
tunnelBenches (Proxy::Proxy '(F4 * F3 * F5 * F7 * F13,
F4 * F3 * F5 * F7 *F13,
F9 * F5 * F7 * F13,
F9 * F5 * F7 * F13,
Zq PP32,
Zq 3144961))]]
defaultKHPRFBenches :: (forall m r . (Fact m, NFData r) => NFData (t m r), _)
=> Proxy t -> Proxy gad -> rnd [Benchmark]
defaultKHPRFBenches = khprfBenches