Skip to content

Instantly share code, notes, and snippets.

AndreasPK

  • Vienna, Austria
Block or report user

Report or block AndreasPK

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AndreasPK
AndreasPK / Curious.hs
Created Feb 19, 2018
On GHC-8.2 this code is faster in GHCi then when compiled.
View Curious.hs
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Data.Text as T
import Data.Text (Text(..))
longestCommonSubstring :: [Text] -> Text
longestCommonSubstring entries = go [""] "" where
View runNofib.sh
#!/usr/bin/env bash
LOGNAME=$1
LOG_DIR=~/logs4
TREE_DIR=~/trees4
RUNS=7
if [ -z "$1" ]
then
@AndreasPK
AndreasPK / ReportSoC_2018.md
Last active Aug 14, 2018
Final report - SoC 2018 - Andreas Klebinger
View ReportSoC_2018.md

Improvements to GHCs Code Generator

This is a writeup of the work done by me (Andreas Klebinger) during my SoC 2018 Project.

Improved code layout for GHC

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.

View gist:24864a0c96df9bda643b345865cd5e81
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
View gist:91035fbf77694bf1bd509f60ff679479
| 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
{
View Day21.reddit.hs
#!/usr/bin/env stack
{-
stack
script
--resolver lts-12.20
--package text,trifecta,containers,parsers,mtl,vector,deepseq
-}
{-# LANGUAGE RecordWildCards, BangPatterns #-}
{-# OPTIONS_GHC -O2 #-}
View gist:4c2258d73cf37bf90babcb7ee190423f
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
View gist:42cdc931ec29b2ce4cc6b551093e9407
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
View matchFailure.hs
compiler\nativeGen\X86\CodeGen.hs:169:1: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In an equation for `verifyBasicBlock':
Patterns not matched: _ :: [Instr]
|
169 | verifyBasicBlock instrs
-- Verifying basic blocks is cheap, but not cheap enough to enable it unconditionally.
verifyBasicBlock :: [Instr] -> ()
You can’t perform that action at this time.