mirror of
https://github.com/github/semantic.git
synced 2024-12-18 04:11:48 +03:00
926e81b8a0
The interface in Semantic.Util had changed. Also removes the old `evalRubyFile` and `evalPythonFile` functions, since they did not typecheck in ghci and do nothing that the project equivalents don't.
30 lines
1.2 KiB
Haskell
30 lines
1.2 KiB
Haskell
module Main where
|
|
|
|
import Criterion.Main
|
|
import Semantic.Util
|
|
import Data.Monoid
|
|
import Control.Monad
|
|
|
|
-- We use `fmap show` to ensure that all the parts of the result of evaluation are
|
|
-- evaluated themselves. While an NFData instance is the most morally correct way
|
|
-- to do this, I'm reluctant to add NFData instances to every single datatype in the
|
|
-- project—coercing the result into a string will suffice, though it throws off the
|
|
-- memory allocation results a bit.
|
|
pyEval :: FilePath -> Benchmarkable
|
|
pyEval = whnfIO . fmap show . evalPythonProject . ("bench/bench-fixtures/python/" <>)
|
|
|
|
rbEval :: FilePath -> Benchmarkable
|
|
rbEval = whnfIO . fmap show . evalRubyProject . ("bench/bench-fixtures/ruby/" <>)
|
|
|
|
main :: IO ()
|
|
main = defaultMain
|
|
[ bgroup "python" [ bench "assignment" $ pyEval "simple-assignment.py"
|
|
, bench "function def" $ pyEval "function-definition.py"
|
|
, bench "if + function calls" $ pyEval "if-statement-functions.py"
|
|
]
|
|
, bgroup "ruby" [ bench "assignment" $ rbEval "simple-assignment.rb"
|
|
, bench "function def" $ rbEval "function-definition.rb"
|
|
, bench "if + function calls" $ rbEval "if-statement-functions.rb"
|
|
]
|
|
]
|