module Main where

import Criterion.Main
import GR4J
    
runSeries :: Int -> [Double]
runSeries n =
      [q | (q, _) <- run
                     (replicate n (Observation "" 20 10 0))
                     (ParameterSet 400 1 150 5)
                     (State 200 75 (replicate 5 0) (replicate 10 0))
      ]

runDay :: Int -> Double
runDay _ =
     fst
      (model
       (Observation "" 20 10 0)
       (ParameterSet 400 1 150 5)
       (State 200 75 [0,0,0,0,0] [0,0,0,0,0,0,0,0,0,0])
      )
     
updateUH :: Int -> [[Double]]
updateUH n =
    [updateUnitHydrograph sCurve2 5 1 (replicate 10 0) |  _ <- [1..n]]
              

main :: IO ()
main = defaultMain [
        bgroup "GR4J" [
         bench "1 day" $ nf runDay 1,
         bench "30 years of daily (10,950)" $ nf runSeries 10950,
         bench "30 years of hourly (262,800)" $ nf runSeries 262800,
         bench "update UH" $ nf updateUH 10950               
        ]
       ]
