From b4c7f9844b11a0ce5c7d8c0b83baf6a8fb95ed28 Mon Sep 17 00:00:00 2001 From: Alexander Vershilov Date: Sun, 4 Sep 2022 16:59:16 +0300 Subject: [PATCH] Remove extra spaces. --- README.markdown | 4 ++-- files/module.template.gnuplot | 2 +- files/package.template.gnuplot | 2 +- src/Compare.hs | 14 +++++++------- src/Generate.hs | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.markdown b/README.markdown index ab865f9..b2d1d9d 100644 --- a/README.markdown +++ b/README.markdown @@ -30,11 +30,11 @@ cabal v2-build ``` At this point I don't suggest you to install the tool because -at such an early stage it will likely require manual configuration +at such an early stage it will likely require manual configuration a lot. 3. Configure your project in order to generate timing files: - + ```bash cabal v2-configure --ghc-options=-ddump-timings --ghc-options=-ddump-to-file ``` diff --git a/files/module.template.gnuplot b/files/module.template.gnuplot index e121e0f..9b23fbf 100644 --- a/files/module.template.gnuplot +++ b/files/module.template.gnuplot @@ -19,5 +19,5 @@ set grid y set style data lines plot '' using ($0-0.2):3 index 0 with boxes title "before", \ '' using ($0+0.2):4 index 0 with boxes title "after", \ - '' using ($0):xtic(1) lw 0 notitle + '' using ($0):xtic(1) lw 0 notitle diff --git a/files/package.template.gnuplot b/files/package.template.gnuplot index 95e43dd..d9a0f29 100644 --- a/files/package.template.gnuplot +++ b/files/package.template.gnuplot @@ -1,6 +1,6 @@ set datafile separator "\t" set terminal svg size 8000,4000 -set output '' +set output '' set datafile missing "" set xlabel "ms" diff --git a/src/Compare.hs b/src/Compare.hs index 0fb4c5a..665819b 100644 --- a/src/Compare.hs +++ b/src/Compare.hs @@ -22,7 +22,7 @@ import qualified Data.Map.Strict as Map import qualified Data.Text.IO as T import qualified Data.Text as T import qualified Data.Vector as V -import qualified Data.Vector.Mutable as V (write) +import qualified Data.Vector.Mutable as V (write) import qualified Prelude import GhcBuildPhase @@ -51,7 +51,7 @@ runCompare beforeDir afterDir out = do withCurrentDirectory out $ do renderModules mergedModulesData renderPackage mergedModulesData - + -- ** Helpers for `compare` checkDirectoriesExistence :: FilePath -> FilePath -> IO () @@ -144,7 +144,7 @@ mergeModulesReports modulesBefore modulesAfter = } where ix = moduleMap Map.! name - + in List.foldl' update vec bs go vec [] as = let update v (moduleName, moduleData) @@ -160,7 +160,7 @@ mergeModulesReports modulesBefore modulesAfter = ix = moduleMap Map.! name in List.foldl' update vec as go vec oldB@(b : bs) oldA@(a : as) = case fst b `compare` fst a of - EQ -> let update v moduleName moduleDataBefore moduleDataAfter + EQ -> let update v moduleName moduleDataBefore moduleDataAfter = V.modify (modifier moduleName moduleDataBefore moduleDataAfter) v @@ -174,7 +174,7 @@ mergeModulesReports modulesBefore modulesAfter = where ix = moduleMap Map.! name in go (update vec (fst b) (snd b) (snd a)) bs as - LT -> let update v make (moduleName, moduleData) + LT -> let update v make (moduleName, moduleData) = V.modify (modifier make moduleName moduleData) v modifier make name data' v = V.write v ix @@ -186,7 +186,7 @@ mergeModulesReports modulesBefore modulesAfter = where ix = moduleMap Map.! name in go (update vec makeBefore b) bs oldA - GT -> let update v make (moduleName, moduleData) + GT -> let update v make (moduleName, moduleData) = V.modify (modifier make moduleName moduleData) v modifier make name data' v = V.write v ix @@ -388,7 +388,7 @@ renderModules rows = do removeFile "module.template.gnuplot" where opts = Csv.defaultEncodeOptions { Csv.encDelimiter = fromIntegral (ord '\t') } - renderRow row = + renderRow row = let content = mconcat (Prelude.map (Csv.encodeRecordWith opts) [ ( phaseReportPhaseName pr diff --git a/src/Generate.hs b/src/Generate.hs index d3d10d8..665030f 100644 --- a/src/Generate.hs +++ b/src/Generate.hs @@ -66,7 +66,7 @@ runGenerate dir = do Prelude.putStrLn "Warning, some files are failed to be parsed" Prelude.print files_failed - + -- Output all files in json form for later analysis. results <- for files_parsed $ \f -> do steps <- fmap parsePhases $ T.readFile (rebuildFilePath f) @@ -84,7 +84,7 @@ runGenerate dir = do -- FIXME: put this file back later -- encodeFile (output "stats_by_package" <.> "json") stats_by_package for_ (Map.toList stats_by_package) $ \(package, stat) -> do - let headers = Set.toList $ Set.fromList + let headers = Set.toList $ Set.fromList [ phaseName | (_, steps) <- Map.toList stat , Phase{..} <- steps @@ -94,7 +94,7 @@ runGenerate dir = do , Prelude.map (\n -> Map.lookup n by_phase) headers) | (GhcFile{..}, steps) <- Map.toList stat , let total = Prelude.sum [phaseTime | Phase{..} <- steps] - , let by_phase = Map.fromListWith (+) + , let by_phase = Map.fromListWith (+) [ (phaseName, phaseTime) | Phase{..} <- steps ] @@ -103,7 +103,7 @@ runGenerate dir = do mkHtmlFile ("./tmp/" <> package <> ".html") $ Report.packageTable package headers rows let bs = Csv.encodeHeader (V.fromList ("module": "total": Prelude.map T.encodeUtf8 headers)) - <> mconcat (Prelude.map Csv.encodeRecord + <> mconcat (Prelude.map Csv.encodeRecord [ Prelude.map T.encodeUtf8 $ T.pack (joinPath modulePath):(showt total):Prelude.map showt cols | (GhcFile{..}, total, cols) <- rows ]) @@ -133,6 +133,6 @@ findDumpTimings input = do mkHtmlFile :: FilePath -> Markup -> IO () mkHtmlFile fn markup = do B.writeFile fn "" -- TODO: properly cleanup the file - renderMarkupToByteStringIO + renderMarkupToByteStringIO (B.appendFile fn) -- TODO: keep handle opened instead of reopening each time. markup