This is a writeup of the work done by me (Andreas Klebinger) during my SoC 2018 Project.
The vast majority of my time was spent working on this part of the Project. While the patch was not yet merged there is not much missing.
Tue Aug 27 19:56 2019 Time and Allocation Profiling Report (Final) | |
ghc.exe +RTS -p -RTS Main.hs --make -O -fforce-recomp | |
total time = 7.72 secs (7721 ticks @ 1000 us, 1 processor) | |
total alloc = 9,747,651,160 bytes (excludes profiling overheads) | |
COST CENTRE MODULE SRC %time %alloc | |
simplIdF Simplify compiler\simplCore\Simplify.hs:899:61-79 16.9 18.1 |
Tue Aug 27 19:56 2019 Time and Allocation Profiling Report (Final) | |
ghc.exe +RTS -p -RTS Main.hs --make -O -fforce-recomp | |
total time = 7.72 secs (7721 ticks @ 1000 us, 1 processor) | |
total alloc = 9,747,651,160 bytes (excludes profiling overheads) | |
COST CENTRE MODULE SRC %time %alloc | |
simplIdF Simplify compiler\simplCore\Simplify.hs:899:61-79 16.9 18.1 |
#!/usr/bin/env stack | |
{- | |
stack | |
script | |
--resolver lts-12.20 | |
--package text,trifecta,containers,parsers,mtl,vector,deepseq | |
-} | |
{-# LANGUAGE RecordWildCards, BangPatterns #-} | |
{-# OPTIONS_GHC -O2 #-} |
| x == A = e1 | |
| x == B = e2 | |
| predFunc(x) = e3 | |
case (case x of { C1 -> (Weight: 1000) A; | |
C2 -> (Weight: 1000) B; | |
C3 -> (Weight: 1000) e3; } ) of | |
{ |
Consider a simple definition using guards: | |
foo x | |
| x == C1 = { -# LIKELY 10 #- } e1 | |
| otherwise = { -# LIKELY 0 #- } e2 | |
with C1 being defined by T using uniform default weights: | |
data T = {-# LIKELY 1000 #-} C1 |
#!/usr/bin/env bash | |
LOGNAME=$1 | |
LOG_DIR=~/logs4 | |
TREE_DIR=~/trees4 | |
RUNS=7 | |
if [ -z "$1" ] | |
then |
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import qualified Data.Text as T | |
import Data.Text (Text(..)) | |
longestCommonSubstring :: [Text] -> Text | |
longestCommonSubstring entries = go [""] "" where |
GHCi does not respect Module Pragmas (https://ghc.haskell.org/trac/ghc/ticket/11469) Pattern Matching (https://ghc.haskell.org/trac/ghc/ticket/14201)