1{-# LANGUAGE BangPatterns #-}
3module Timer (timer) where
5import Control.Exception (evaluate)
6import Data.Time.Clock.POSIX (getPOSIXTime)
7import GHC.Float (FFFormat(..), formatRealFloat)
9ickyRound :: Int -> Double -> String
10ickyRound k = formatRealFloat FFFixed (Just k)
12timer :: Int -> a -> (a -> b) -> IO String
15 | k <= 0 = return fastest
20 | otherwise = evaluate (f a) >> inner a (i-1)
23 let elapsed = end - start
24 loop (k-1) (min fastest (elapsed / fromIntegral count))
25 t <- loop (3::Int) 1e300
26 let log10 x = log x / log 10
28 prec = round (log10 (fromIntegral count) - log10 ft)
29 return $! ickyRound prec ft
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list