1
1
mirror of https://github.com/github/semantic.git synced 2024-11-27 12:57:49 +03:00

fix the benchmarks

This commit is contained in:
Patrick Thomson 2020-01-26 11:39:57 -05:00
parent 0acaae2529
commit 5a23a151fb
2 changed files with 12 additions and 10 deletions

View File

@ -11,7 +11,7 @@ import Control.Carrier.Parse.Simple
import Data.Abstract.Evaluatable import Data.Abstract.Evaluatable
import Data.Bifunctor import Data.Bifunctor
import Data.Blob import Data.Blob
import Data.Blob.IO (readBlobFromFile') import Data.Blob.IO (readBlobFromPath)
import qualified Data.Duration as Duration import qualified Data.Duration as Duration
import "semantic" Data.Graph (topologicalSort) import "semantic" Data.Graph (topologicalSort)
import qualified Data.Language as Language import qualified Data.Language as Language
@ -25,19 +25,21 @@ import Semantic.Task (TaskSession (..), runTask, withOptions)
import Semantic.Util import Semantic.Util
import System.Path ((</>)) import System.Path ((</>))
import qualified System.Path as Path import qualified System.Path as Path
import qualified System.Path.PartClass as Path.PartClass
-- Duplicating this stuff from Util to shut off the logging -- Duplicating this stuff from Util to shut off the logging
callGraphProject' :: ( Language.SLanguage lang callGraphProject' :: ( Language.SLanguage lang
, HasPrelude lang , HasPrelude lang
, Path.PartClass.AbsRel ar
) )
=> TaskSession => TaskSession
-> Proxy lang -> Proxy lang
-> Path.RelFile -> Path.File ar
-> IO (Either String ()) -> IO (Either String ())
callGraphProject' session proxy path callGraphProject' session proxy path
| Just (SomeParser parser) <- parserForLanguage analysisParsers lang = fmap (bimap show (const ())) . runTask session $ do | Just (SomeParser parser) <- parserForLanguage analysisParsers lang = fmap (bimap show (const ())) . runTask session $ do
blob <- readBlobFromPath path blob <- readBlobFromPath (Path.toAbsRel path)
package <- fmap snd <$> runParse (Duration.fromSeconds 10) (parsePackage parser (Project (Path.toString (Path.takeDirectory path)) [blob] lang [])) package <- fmap snd <$> runParse (Duration.fromSeconds 10) (parsePackage parser (Project (Path.toString (Path.takeDirectory path)) [blob] lang []))
modules <- topologicalSort <$> runImportGraphToModules proxy package modules <- topologicalSort <$> runImportGraphToModules proxy package
runCallGraph proxy False modules package runCallGraph proxy False modules package

View File

@ -8,19 +8,19 @@ import Control.Carrier.Parse.Measured
import Control.Carrier.Reader import Control.Carrier.Reader
import Control.Exception (throwIO) import Control.Exception (throwIO)
import Control.Monad import Control.Monad
import Data.Blob
import Data.Foldable import Data.Foldable
import Data.Language (LanguageMode (..), PerLanguageModes (..)) import Data.Language (LanguageMode (..), PerLanguageModes (..))
import Gauge import Gauge
import System.FilePath.Glob import System.FilePath.Glob
import qualified System.Path as Path import qualified System.Path as Path
import Data.Flag import qualified Analysis.File as File
import Proto.Semantic as P hiding (Blob, BlobPair) import Data.Flag
import Semantic.Api.Symbols (parseSymbols) import Proto.Semantic as P hiding (Blob, BlobPair)
import Semantic.Config as Config import Semantic.Api.Symbols (parseSymbols)
import Semantic.Task import Semantic.Config as Config
import Semantic.Task.Files import Semantic.Task
import Semantic.Task.Files
benchmarks :: Benchmark benchmarks :: Benchmark
benchmarks = bgroup "tagging" benchmarks = bgroup "tagging"