-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: merge linear-dest back into linear-base
Current status: build successfully using stock ghc version
- Loading branch information
Showing
58 changed files
with
203,881 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ghc*.tar.xz filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ cabal.sandbox.config | |
.stack-work/ | ||
cabal.project.local | ||
.HTF/ | ||
|
||
ghc-dps-compact-702220602b |
20 changes: 20 additions & 0 deletions
20
bench-version-changes/ghc-dps-compact/after/Bench/Compact.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Bench.Compact where | ||
|
||
import Test.Tasty.Bench | ||
|
||
import Bench.Compact.BFTraversal (bftraversalBenchgroup) | ||
import Bench.Compact.Map (mapBenchgroup) | ||
import Bench.Compact.DList (dlistBenchgroup) | ||
import Bench.Compact.Queue (queueBenchgroup) | ||
import Bench.Compact.SExpr (sexprBenchgroup) | ||
|
||
benchmarks :: Benchmark | ||
benchmarks = | ||
bgroup | ||
"DPS interface for compact regions" | ||
[ bftraversalBenchgroup | ||
, mapBenchgroup | ||
, dlistBenchgroup | ||
, queueBenchgroup | ||
, sexprBenchgroup | ||
] |
24 changes: 24 additions & 0 deletions
24
bench-version-changes/ghc-dps-compact/after/Bench/Compact/BFTraversal.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module Bench.Compact.BFTraversal where | ||
|
||
import Compact.BFTraversal as BFTraversal | ||
import Bench.Compact.Utils as Utils | ||
import Control.Exception (evaluate) | ||
import Control.DeepSeq (force) | ||
import Test.Tasty.Bench (Benchmark) | ||
|
||
dataSets :: [(IO (BinTree ()), String)] | ||
dataSets = | ||
[ (evaluate $ force (go 0 10), "2^10") | ||
, (evaluate $ force (go 0 13), "2^13") | ||
, (evaluate $ force (go 0 16), "2^16") | ||
, (evaluate $ force (go 0 19), "2^19") | ||
, (evaluate $ force (go 0 22), "2^22") | ||
] | ||
where | ||
go :: Int -> Int -> BinTree () | ||
go currentDepth maxDepth = | ||
if currentDepth >= maxDepth | ||
then Nil | ||
else Node () (go (currentDepth + 1) maxDepth) (go (currentDepth + 1) maxDepth) | ||
|
||
bftraversalBenchgroup = Utils.benchImpls BFTraversal.impls dataSets |
18 changes: 18 additions & 0 deletions
18
bench-version-changes/ghc-dps-compact/after/Bench/Compact/DList.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Bench.Compact.DList where | ||
|
||
import Compact.DList as DList | ||
import Bench.Compact.Utils as Utils | ||
import Control.Exception (evaluate) | ||
import Control.DeepSeq (force) | ||
import Test.Tasty.Bench (Benchmark) | ||
|
||
dataSets :: [(IO [[Int]], String)] | ||
dataSets = | ||
[ (evaluate $ force (fmap (\i -> [(10 * i + 0)..(10 * i + 9)]) [0..(((2^10) `div` 10) - 1)]), "2^10") | ||
, (evaluate $ force (fmap (\i -> [(10 * i + 0)..(10 * i + 9)]) [0..(((2^13) `div` 10) - 1)]), "2^13") | ||
, (evaluate $ force (fmap (\i -> [(10 * i + 0)..(10 * i + 9)]) [0..(((2^16) `div` 10) - 1)]), "2^16") | ||
, (evaluate $ force (fmap (\i -> [(10 * i + 0)..(10 * i + 9)]) [0..(((2^19) `div` 10) - 1)]), "2^19") | ||
, (evaluate $ force (fmap (\i -> [(10 * i + 0)..(10 * i + 9)]) [0..(((2^22) `div` 10) - 1)]), "2^22") | ||
] | ||
|
||
dlistBenchgroup = benchImpls DList.impls dataSets |
19 changes: 19 additions & 0 deletions
19
bench-version-changes/ghc-dps-compact/after/Bench/Compact/Map.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{-# LANGUAGE LinearTypes #-} | ||
module Bench.Compact.Map where | ||
|
||
import Compact.Map as Map | ||
import Bench.Compact.Utils as Utils | ||
import Control.Exception (evaluate) | ||
import Control.DeepSeq (force) | ||
import Test.Tasty.Bench (Benchmark) | ||
|
||
dataSets :: [(IO (Int %1 -> Int, [Int]), String)] | ||
dataSets = | ||
[ ((\x -> 2 * x + 1,) <$> (evaluate $ force [1 .. 2^10]), "2^10") | ||
, ((\x -> 2 * x + 1,) <$> (evaluate $ force [1 .. 2^13]), "2^13") | ||
, ((\x -> 2 * x + 1,) <$> (evaluate $ force [1 .. 2^16]), "2^16") | ||
, ((\x -> 2 * x + 1,) <$> (evaluate $ force [1 .. 2^19]), "2^19") | ||
, ((\x -> 2 * x + 1,) <$> (evaluate $ force [1 .. 2^22]), "2^22") | ||
] | ||
|
||
mapBenchgroup = benchImpls Map.impls dataSets |
18 changes: 18 additions & 0 deletions
18
bench-version-changes/ghc-dps-compact/after/Bench/Compact/Queue.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Bench.Compact.Queue where | ||
|
||
import Compact.Queue as Queue | ||
import Bench.Compact.Utils as Utils | ||
import Control.Exception (evaluate) | ||
import Control.DeepSeq (force) | ||
import Test.Tasty.Bench (Benchmark) | ||
|
||
dataSets :: [(IO Word64, String)] | ||
dataSets = | ||
[ (return $ 2^10, "2^10") | ||
, (return $ 2^13, "2^13") | ||
, (return $ 2^16, "2^16") | ||
, (return $ 2^19, "2^19") | ||
, (return $ 2^22, "2^22") | ||
] | ||
|
||
queueBenchgroup = benchImpls Queue.impls dataSets |
22 changes: 22 additions & 0 deletions
22
bench-version-changes/ghc-dps-compact/after/Bench/Compact/SExpr.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Bench.Compact.SExpr where | ||
|
||
import Compact.SExpr as SExpr | ||
import Bench.Compact.Utils as Utils | ||
import Control.Exception (evaluate) | ||
import Control.DeepSeq (force) | ||
import qualified Data.ByteString.Char8 as BSC | ||
import Test.Tasty.Bench (Benchmark) | ||
|
||
dataSetDir :: String | ||
dataSetDir = "bench-version-changes/ghc-dps-compact/after/datasets/" | ||
|
||
dataSets :: [(IO ByteString, String)] | ||
dataSets = | ||
[ (evaluate . force =<< BSC.readFile (dataSetDir ++ "data_2_10.sexpr"), "2^10") | ||
, (evaluate . force =<< BSC.readFile (dataSetDir ++ "data_2_13.sexpr"), "2^13") | ||
, (evaluate . force =<< BSC.readFile (dataSetDir ++ "data_2_16.sexpr"), "2^16") | ||
, (evaluate . force =<< BSC.readFile (dataSetDir ++ "data_2_19.sexpr"), "2^19") | ||
, (evaluate . force =<< BSC.readFile (dataSetDir ++ "data_2_22.sexpr"), "2^22") | ||
] | ||
|
||
sexprBenchgroup = Utils.benchImpls SExpr.impls dataSets |
80 changes: 80 additions & 0 deletions
80
bench-version-changes/ghc-dps-compact/after/Bench/Compact/Utils.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{-# LANGUAGE LinearTypes #-} | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE ImpredicativeTypes #-} | ||
{-# LANGUAGE KindSignatures #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
|
||
module Bench.Compact.Utils where | ||
|
||
import Control.DeepSeq | ||
import Test.Tasty (TestTree, testGroup) | ||
import Test.Tasty.HUnit (testCaseInfo, assertEqual) | ||
import Test.Tasty.Bench | ||
import Control.Exception (evaluate) | ||
import Data.Functor ((<&>)) | ||
import GHC.Compact (compact, getCompact) | ||
|
||
import qualified Compact.Map as Map | ||
import qualified Compact.BFTraversal as BFTraversal | ||
import qualified Compact.DList as DList | ||
import qualified Compact.Queue as Queue | ||
import qualified Compact.SExpr as SExpr | ||
|
||
import qualified Bench.Compact.Map as Map | ||
import qualified Bench.Compact.BFTraversal as BFTraversal | ||
import qualified Bench.Compact.DList as DList | ||
import qualified Bench.Compact.Queue as Queue | ||
import qualified Bench.Compact.SExpr as SExpr | ||
|
||
benchImpls :: forall m a r. (NFData r) => String -> [(a %m -> r, String, Bool)] -> [(IO a, String)] -> Benchmark | ||
benchImpls name impls datasets = do | ||
bgroup name ( | ||
datasets <&> \(loadSampleData, sizeName) -> env loadSampleData $ \sampleData -> | ||
testGroup sizeName $ concat $ impls <&> \(impl, implName, isLazy) -> if isLazy | ||
then | ||
[ bench (implName ++ ".force") $ (flip whnfAppIO) sampleData $ \sampleData -> evaluate $ force $ impl sampleData, | ||
bench (implName ++ ".copyIntoReg") $ (flip whnfAppIO) sampleData $ \sampleData -> do | ||
resInRegion <- compact $ impl sampleData | ||
evaluate $ getCompact $ resInRegion | ||
] | ||
else | ||
[ bench implName $ (flip whnfAppIO) sampleData $ \sampleData -> evaluate $ impl sampleData ]) | ||
|
||
launchImpl :: String -> IO () | ||
launchImpl s = | ||
let (_all, dotModuleName) = span (/= '.') s | ||
(moduleName, dotBenchmark) = span (/= '.') (tail dotModuleName) | ||
(_benchmark, dotImplSizeSpec) = span (/= '.') (tail dotBenchmark) | ||
implSizeSpec = tail dotImplSizeSpec | ||
in case (_all ++ "." ++ moduleName ++ "." ++ _benchmark) of | ||
"All.Bench.Compact.Map.benchmark" -> Utils.launchImpl' implSizeSpec Map.impls Map.dataSets | ||
"All.Bench.Compact.BFTraversal.benchmark" -> Utils.launchImpl' implSizeSpec BFTraversal.impls BFTraversal.dataSets | ||
"All.Bench.Compact.DList.benchmark" -> Utils.launchImpl' implSizeSpec DList.impls DList.dataSets | ||
"All.Bench.Compact.Queue.benchmark" -> Utils.launchImpl' implSizeSpec Queue.impls Queue.dataSets | ||
"All.Bench.Compact.SExpr.benchmark" -> Utils.launchImpl' implSizeSpec SExpr.impls SExpr.dataSets | ||
s' -> error ("benchmark group '" ++ s' ++ "' not found") | ||
|
||
launchImpl' :: forall m a r. (NFData r) => String -> [(a %m -> r, String, Bool)] -> [(IO a, String)] -> IO () | ||
launchImpl' requestedImplDataSetspec impls datasets = go impls (go' datasets) where | ||
(requestedSize, dotRequestedImplSpec) = span (/= '.') requestedImplDataSetspec | ||
(requestedImplRadical, requestedImplVariant) = span (/= '.') (tail dotRequestedImplSpec) | ||
go [] _ = error ("requested implementation '" ++ requestedImplRadical ++ "' not found") | ||
go ((impl, implName, isLazy):_) loadSampleData | implName == requestedImplRadical = do | ||
sampleData <- loadSampleData | ||
if isLazy | ||
then case requestedImplVariant of | ||
".force" -> evaluate $ rwhnf $ force $ impl sampleData | ||
".copyIntoReg" -> do | ||
resInRegion <- compact $ impl sampleData | ||
evaluate $ rwhnf $ getCompact $ resInRegion | ||
_ -> error ("variant '" ++ requestedImplVariant ++ "' not found (required for lazy impl)") | ||
else | ||
evaluate $ rwhnf $ impl sampleData | ||
putStrLn "Done!" | ||
go (_:xs) loadSampleData = go xs loadSampleData | ||
|
||
go' [] = error ("requested size '" ++ requestedSize ++ "' not found") | ||
go' ((loadSampleData, sizeName):_) | sizeName == requestedSize = loadSampleData | ||
go' (_:xs) = go' xs |
46 changes: 46 additions & 0 deletions
46
bench-version-changes/ghc-dps-compact/after/datasets/data_2_10.sexpr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
( | ||
(ert-deftest company-shows-keywords-alongside-completions-alphabetically () | ||
:tags '(company) | ||
(switch-to-buffer "*TESTING COMPANY MODE ~ Python*") | ||
(python-mode) | ||
|
||
|
||
(erase-buffer) | ||
(insert "\n def first(x): pass") | ||
(insert "\n def fierce(a, b): pass") | ||
|
||
|
||
(insert "\n fi") | ||
(company-manual-begin) | ||
(should (equal company-candidates '("fierce" "first" #("finally" 0 7 (company-backend company-keywords))))) | ||
|
||
|
||
(execute-kbd-macro (kbd "C-g C-/ M-2")) | ||
(should (looking-back "finally")) | ||
|
||
(kill-buffer)) | ||
|
||
|
||
(ert-deftest company-shows-keywords-alongside-completions-alphabetically () | ||
:tags '(company) | ||
(switch-to-buffer "*TESTING COMPANY MODE ~ Python*") | ||
(python-mode) | ||
|
||
|
||
(erase-buffer) | ||
(insert "\n def first(x): pass") | ||
(insert "\n def fierce(a, b): pass") | ||
|
||
|
||
(insert "\n fi") | ||
(company-manual-begin) | ||
(should (equal company-candidates '("fierce" "first" #("finally" 0 7 (company-backend company-keywords))))) | ||
|
||
|
||
(execute-kbd-macro (kbd "C-g C-/ M-2")) | ||
(should (looking-back "finally")) | ||
|
||
(kill-buffer)) | ||
|
||
|
||
) |
Oops, something went wrong.