Skip to content

Instantly share code, notes, and snippets.

@hasufell
Created July 4, 2022 14:18
Show Gist options
  • Save hasufell/653dea9cc5ad0f0d6cd35e47442fe35b to your computer and use it in GitHub Desktop.
Save hasufell/653dea9cc5ad0f0d6cd35e47442fe35b to your computer and use it in GitHub Desktop.
==================== Tidy Core ====================
2022-07-04 13:58:16.332165709 UTC
Result size of Tidy Core
= {terms: 543, types: 322, coercions: 22, joins: 0/1}
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
lvl :: Addr#
lvl = "Negative exponent"#
-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
$s^1 :: Int
$s^1 = errorWithoutStackTrace (unpackCString# lvl)
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$seven1 :: Integer
$seven1 = 2
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$s^2 :: Integer
$s^2 = 0
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
lvl1 :: Integer
lvl1 = 1
Rec {
-- RHS size: {terms: 38, types: 5, coercions: 0, joins: 0/0}
$wg1 :: Int# -> Integer -> Int# -> Int#
$wg1
= \ (ww :: Int#) (w :: Integer) (ww1 :: Int#) ->
case integerEq# (integerRem w $seven1) $s^2 of {
__DEFAULT ->
case integerEq# w lvl1 of {
__DEFAULT -> $wg1 (*# ww ww) (integerQuot w $seven1) (*# ww ww1);
1# -> *# ww ww1
};
1# -> $wg1 (*# ww ww) (integerQuot w $seven1) ww1
}
end Rec }
Rec {
-- RHS size: {terms: 32, types: 4, coercions: 0, joins: 0/0}
$wf :: Int# -> Integer -> Int#
$wf
= \ (ww :: Int#) (w :: Integer) ->
case integerEq# (integerRem w $seven1) $s^2 of {
__DEFAULT ->
case integerEq# w lvl1 of {
__DEFAULT -> $wg1 (*# ww ww) (integerQuot w $seven1) ww;
1# -> ww
};
1# -> $wf (*# ww ww) (integerQuot w $seven1)
}
end Rec }
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$trModule4 :: Addr#
$trModule4 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
$trModule3 :: TrName
$trModule3 = TrNameS $trModule4
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$trModule2 :: Addr#
$trModule2 = "BenchShort"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
$trModule1 :: TrName
$trModule1 = TrNameS $trModule2
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
$trModule :: Module
$trModule = Module $trModule3 $trModule1
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
loc :: [Char]
loc = unpackCString# $trModule4
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
loc1 :: [Char]
loc1 = unpackCString# $trModule2
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
loc2 :: Addr#
loc2 = "bench/BenchShort.hs"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
loc3 :: [Char]
loc3 = unpackCString# loc2
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
loc4 :: Int
loc4 = I# 74#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
loc5 :: Int
loc5 = I# 17#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
loc6 :: Int
loc6 = I# 26#
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
benchShort11 :: Addr#
benchShort11 = "foldr1'"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
benchShort10 :: [Char]
benchShort10 = unpackCString# benchShort11
-- RHS size: {terms: 8, types: 0, coercions: 0, joins: 0/0}
$dIP :: SrcLoc
$dIP = SrcLoc loc loc1 loc3 loc4 loc5 loc4 loc6
-- RHS size: {terms: 4, types: 0, coercions: 0, joins: 0/0}
$dIP1 :: CallStack
$dIP1 = PushCallStack benchShort10 $dIP EmptyCallStack
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
lvl2 :: Integer
lvl2 = 6
Rec {
-- RHS size: {terms: 36, types: 20, coercions: 0, joins: 0/0}
$wgo3 :: Int# -> (# Word8, [Word8] #)
$wgo3
= \ (w :: Int#) ->
(# case >=# w 0# of {
__DEFAULT -> $wlvl3 w;
1# ->
case <=# w 255# of {
__DEFAULT -> $wlvl3 w;
1# -> W8# (wordToWord8# (int2Word# w))
}
},
case w of wild {
__DEFAULT ->
case $wgo3 (+# wild 1#) of { (# ww1, ww2 #) -> : ww1 ww2 };
95# -> []
} #)
end Rec }
-- RHS size: {terms: 7, types: 10, coercions: 0, joins: 0/0}
lvl3 :: [Word8]
lvl3 = case $wgo3 32# of { (# ww1, ww2 #) -> : ww1 ww2 }
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
lim :: Integer
lim = 16
-- RHS size: {terms: 21, types: 6, coercions: 0, joins: 0/0}
$j :: Int# -> ShortByteString
$j
= \ (y :: Int#) ->
case <# 0# y of {
__DEFAULT -> case $wpack [] of ww { __DEFAULT -> SBS ww };
1# ->
case $wpack ($wunsafeTake y lvl3) of ww { __DEFAULT -> SBS ww }
}
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
lvl4 :: ShortByteString
lvl4 = $j 1#
-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
lvl5 :: [Word8]
lvl5 = ++ lvl3 []
Rec {
-- RHS size: {terms: 12, types: 3, coercions: 0, joins: 0/0}
$wxs :: Int# -> [Word8]
$wxs
= \ (ww :: Int#) ->
case ww of ds1 {
__DEFAULT -> ++ lvl3 ($wxs (-# ds1 1#));
1# -> lvl5
}
end Rec }
-- RHS size: {terms: 7, types: 1, coercions: 0, joins: 0/0}
lvl6 :: ShortByteString
lvl6 = case $wpack ($wxs 1#) of ww { __DEFAULT -> SBS ww }
Rec {
-- RHS size: {terms: 84, types: 18, coercions: 0, joins: 0/1}
benchShort_go3 :: Integer -> [ShortByteString]
benchShort_go3
= \ (x :: Integer) ->
case integerGt# x lim of {
__DEFAULT ->
: (case integerLe# x lvl2 of {
__DEFAULT ->
let {
w :: Integer
w = integerSub x lvl2 } in
case integerLt# w $s^2 of {
__DEFAULT ->
case integerEq# w $s^2 of {
__DEFAULT ->
case $wf 2# w of ww { __DEFAULT ->
case <# 0# ww of {
__DEFAULT -> case $wpack [] of ww1 { __DEFAULT -> SBS ww1 };
1# -> case $wpack ($wxs ww) of ww1 { __DEFAULT -> SBS ww1 }
}
};
1# -> lvl6
};
1# -> case $s^1 of wild3 { }
};
1# ->
case integerLt# x $s^2 of {
__DEFAULT ->
case integerEq# x $s^2 of {
__DEFAULT -> case $wf 2# x of ww { __DEFAULT -> $j ww };
1# -> lvl4
};
1# -> case $s^1 of wild3 { }
}
})
(benchShort_go3 (integerAdd x lvl1));
1# -> []
}
end Rec }
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
foldInputs :: [ShortByteString]
foldInputs = benchShort_go3 $s^2
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
benchShort22 :: Addr#
benchShort22 = "ShortByteString"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
benchShort21 :: [Char]
benchShort21 = unpackCString# benchShort22
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
eta :: Int
eta = I# 0#
Rec {
-- RHS size: {terms: 26, types: 15, coercions: 0, joins: 0/0}
go1 :: [Word8] -> (Int -> Int) -> Int -> Int
go1
= \ (ds :: [Word8]) (eta2 :: Int -> Int) (eta3 :: Int) ->
case ds of {
[] -> eta2 eta3;
: y ys ->
go1
ys
(\ (z :: Int) ->
case y of { W8# x# ->
case z of { I# y1 ->
eta2 (I# (+# (word2Int# (word8ToWord# x#)) y1))
}
})
eta3
}
end Rec }
Rec {
-- RHS size: {terms: 28, types: 28, coercions: 0, joins: 0/0}
benchShort_$s$wgo1
:: State# RealWorld
-> Word# -> ShortByteString -> (# State# RealWorld, () #)
benchShort_$s$wgo1
= \ (sc :: State# RealWorld)
(sc1 :: Word#)
(sc2 :: ShortByteString) ->
case sc1 of wild {
__DEFAULT ->
case seq# (case sc2 of { SBS ww1 -> go1 ($wunpack ww1) id eta }) sc
of
{ (# ipv, ipv1 #) ->
benchShort_$s$wgo1 ipv (minusWord# wild 1##) sc2
};
0## -> (# sc, () #)
}
end Rec }
-- RHS size: {terms: 17, types: 6, coercions: 0, joins: 0/0}
eta1 :: Word8 -> Word8 -> Word8
eta1
= \ (x :: Word8) (acc :: Word8) ->
case x of { W8# x# ->
case acc of { W8# y# ->
W8#
(wordToWord8#
(plusWord# (and# (word8ToWord# x#) 255##) (word8ToWord# y#)))
}
}
Rec {
-- RHS size: {terms: 27, types: 27, coercions: 4, joins: 0/0}
benchShort_$s$wgo13
:: State# RealWorld
-> Word# -> ShortByteString -> (# State# RealWorld, () #)
benchShort_$s$wgo13
= \ (sc :: State# RealWorld)
(sc1 :: Word#)
(sc2 :: ShortByteString) ->
case sc1 of wild {
__DEFAULT ->
case seq#
(case sc2 of { SBS ww1 ->
$wfoldr1' ($dIP1 `cast` <Co:4>) eta1 ww1
})
sc
of
{ (# ipv, ipv1 #) ->
benchShort_$s$wgo13 ipv (minusWord# wild 1##) sc2
};
0## -> (# sc, () #)
}
end Rec }
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
benchShort20 :: Addr#
benchShort20 = "folds"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
benchShort19 :: [Char]
benchShort19 = unpackCString# benchShort20
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
benchShort18 :: Addr#
benchShort18 = "strict"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
benchShort17 :: [Char]
benchShort17 = unpackCString# benchShort18
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
benchShort16 :: Addr#
benchShort16 = "foldr'"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
benchShort15 :: [Char]
benchShort15 = unpackCString# benchShort16
-- RHS size: {terms: 24, types: 20, coercions: 9, joins: 0/0}
benchShort14 :: ShortByteString -> TestTree
benchShort14
= \ (s :: ShortByteString) ->
SingleTest
$fIsTestBenchmarkable
(case s of { SBS barr# ->
case $witos (sizeofByteArray# barr#) [] of { (# ww1, ww2 #) ->
: ww1 ww2
}
})
((\ (eta2 :: Word64) (eta3 :: State# RealWorld) ->
case eta2 of { W64# ww1 -> benchShort_$s$wgo1 eta3 ww1 s })
`cast` <Co:9>)
-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
benchShort13 :: [TestTree]
benchShort13 = map benchShort14 foldInputs
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
benchShort12 :: TestTree
benchShort12 = TestGroup benchShort15 benchShort13
-- RHS size: {terms: 24, types: 20, coercions: 9, joins: 0/0}
benchShort9 :: ShortByteString -> TestTree
benchShort9
= \ (s :: ShortByteString) ->
SingleTest
$fIsTestBenchmarkable
(case s of { SBS barr# ->
case $witos (sizeofByteArray# barr#) [] of { (# ww1, ww2 #) ->
: ww1 ww2
}
})
((\ (eta2 :: Word64) (eta3 :: State# RealWorld) ->
case eta2 of { W64# ww1 -> benchShort_$s$wgo13 eta3 ww1 s })
`cast` <Co:9>)
-- RHS size: {terms: 4, types: 2, coercions: 0, joins: 0/0}
benchShort9 :: [TestTree]
benchShort9 = map benchShort9 foldInputs
-- RHS size: {terms: 4, types: 0, coercions: 0, joins: 0/0}
benchShort8 :: TestTree
benchShort8 = TestGroup benchShort10 benchShort8
-- RHS size: {terms: 4, types: 2, coercions: 0, joins: 0/0}
benchShort7 :: [Benchmark]
benchShort7 = : benchShort7 []
-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0}
benchShort5 :: [Benchmark]
benchShort5 = : benchShort12 benchShort6
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
benchShort4 :: TestTree
benchShort4 = TestGroup benchShort17 benchShort5
-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
benchShort3 :: [Benchmark]
benchShort3 = : benchShort4 []
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
benchShort2 :: TestTree
benchShort2 = TestGroup benchShort19 benchShort3
-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
benchShort1 :: [Benchmark]
benchShort1 = : benchShort2 []
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
benchShort :: Benchmark
benchShort = TestGroup benchShort21 benchShort1
-- RHS size: {terms: 36, types: 12, coercions: 0, joins: 0/2}
$wunpack :: ByteArray# -> [Word8]
$wunpack
= \ (ww :: ByteArray#) ->
let {
y :: Int#
y = -# (sizeofByteArray# ww) 1# } in
case ># 0# y of {
__DEFAULT ->
letrec {
go3 :: Int# -> [Word8]
go3
= \ (x :: Int#) ->
: (case indexWord8Array# ww x of wild { __DEFAULT -> W8# wild })
(case ==# x y of {
__DEFAULT -> go3 (+# x 1#);
1# -> []
}); } in
go3 0#;
1# -> []
}
-- RHS size: {terms: 6, types: 3, coercions: 0, joins: 0/0}
unpack :: ShortByteString -> [Word8]
unpack
= \ (w :: ShortByteString) -> case w of { SBS ww1 -> $wunpack ww1 }
-- RHS size: {terms: 30, types: 25, coercions: 0, joins: 1/1}
$wfoldr' :: forall {a}. (Word8 -> a -> a) -> a -> ByteArray# -> a
$wfoldr'
= \ (@a) (w :: Word8 -> a -> a) (w1 :: a) (ww :: ByteArray#) ->
joinrec {
go1 :: [Word8] -> (a -> a) -> a -> a
go1 (ds :: [Word8]) (eta :: a -> a) (eta1 :: a)
= case ds of {
[] -> eta eta1;
: y ys ->
jump go1
ys (\ (z :: a) -> case w y z of vx { __DEFAULT -> eta vx }) eta1
}; } in
jump go1 ($wunpack ww) id w1
-- RHS size: {terms: 11, types: 9, coercions: 0, joins: 0/0}
foldr' :: forall a. (Word8 -> a -> a) -> a -> ShortByteString -> a
foldr'
= \ (@a)
(w :: Word8 -> a -> a)
(w1 :: a)
(w2 :: ShortByteString) ->
case w2 of { SBS ww1 -> $wfoldr' w w1 ww1 }
-- RHS size: {terms: 97, types: 43, coercions: 0, joins: 2/3}
$wunpack :: ByteArray# -> [Word8]
$wunpack
= \ (ww :: ByteArray#) ->
letrec {
$wgo5 :: Int# -> Int# -> [Word8] -> [Word8]
$wgo5
= \ (ww1 :: Int#) (ww2 :: Int#) (w :: [Word8]) ->
case <=# ww2 100# of {
__DEFAULT ->
joinrec {
$wgo6 :: Int# -> Int# -> [Word8] -> [Word8]
$wgo6 (ww3 :: Int#) (ww4 :: Int#) (w1 :: [Word8])
= case w1 of acc { __DEFAULT ->
case ==# ww4 ww3 of {
__DEFAULT ->
case indexWord8Array# ww ww4 of wild { __DEFAULT ->
jump $wgo6 ww3 (-# ww4 1#) (: (W8# wild) acc)
};
1# -> acc
}
}; } in
jump $wgo6
(-# ww1 1#) (+# 99# ww1) ($wgo5 (+# ww1 100#) (-# ww2 100#) w);
1# ->
joinrec {
$wgo6 :: Int# -> Int# -> [Word8] -> [Word8]
$wgo6 (ww3 :: Int#) (ww4 :: Int#) (w1 :: [Word8])
= case w1 of acc { __DEFAULT ->
case ==# ww4 ww3 of {
__DEFAULT ->
case indexWord8Array# ww ww4 of wild { __DEFAULT ->
jump $wgo6 ww3 (-# ww4 1#) (: (W8# wild) acc)
};
1# -> acc
}
}; } in
jump $wgo6 (-# ww1 1#) (-# (+# ww2 ww1) 1#) w
}; } in
$wgo5 0# (sizeofByteArray# ww) []
-- RHS size: {terms: 6, types: 3, coercions: 0, joins: 0/0}
unpack :: ShortByteString -> [Word8]
unpack
= \ (w :: ShortByteString) -> case w of { SBS ww1 -> $wunpack ww1 }
-- RHS size: {terms: 30, types: 25, coercions: 0, joins: 1/1}
$wfoldr' :: forall {a}. (Word8 -> a -> a) -> a -> ByteArray# -> a
$wfoldr'
= \ (@a) (w :: Word8 -> a -> a) (w1 :: a) (ww :: ByteArray#) ->
joinrec {
go1 :: [Word8] -> (a -> a) -> a -> a
go1 (ds :: [Word8]) (eta :: a -> a) (eta1 :: a)
= case ds of {
[] -> eta eta1;
: y ys ->
jump go1
ys (\ (z :: a) -> case w y z of vx { __DEFAULT -> eta vx }) eta1
}; } in
jump go1 ($wunpack ww) id w1
-- RHS size: {terms: 11, types: 9, coercions: 0, joins: 0/0}
foldr' :: forall a. (Word8 -> a -> a) -> a -> ShortByteString -> a
foldr'
= \ (@a)
(w :: Word8 -> a -> a)
(w1 :: a)
(w2 :: ShortByteString) ->
case w2 of { SBS ww1 -> $wfoldr' w w1 ww1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment