Last active
December 19, 2015 06:39
-
-
Save rrnewton/5912513 to your computer and use it in GitHub Desktop.
GHC Core generated when using foldrWithKey to build up a monadic action to consume a large Map.
This file contains hidden or 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
Result size of Tidy Core = {terms: 423, types: 423, coercions: 39} | |
lvl_r2uH :: [GHC.Types.Char] | |
[GblId, Str=DmdType] | |
lvl_r2uH = GHC.CString.unpackCString# "Got it!" | |
Rec { | |
Main.$sinsert_$s$sgo6 [Occ=LoopBreaker] | |
:: forall a1_X12s. | |
GHC.Prim.Int# | |
-> a1_X12s | |
-> Data.Map.Base.Map GHC.Types.Int a1_X12s | |
-> Data.Map.Base.Map GHC.Types.Int a1_X12s | |
[GblId, Arity=3, Str=DmdType LSS] | |
Main.$sinsert_$s$sgo6 = | |
\ (@ a1_X12s) | |
(sc_s2sY :: GHC.Prim.Int#) | |
(sc1_s2sZ :: a1_X12s) | |
(sc2_s2t0 :: Data.Map.Base.Map GHC.Types.Int a1_X12s) -> | |
case sc1_s2sZ of arg4_a12t { __DEFAULT -> | |
case sc2_s2t0 of _ { | |
Data.Map.Base.Bin rb_a12w ky_a12x y_a12y l_a12z r_a12A -> | |
case ky_a12x of wild1_s2rn { GHC.Types.I# y#_s2rm -> | |
case GHC.Prim.<# sc_s2sY y#_s2rm of _ { | |
GHC.Types.False -> | |
case GHC.Prim.==# sc_s2sY y#_s2rm of _ { | |
GHC.Types.False -> | |
Data.Map.Base.balanceR | |
@ GHC.Types.Int | |
@ a1_X12s | |
wild1_s2rn | |
y_a12y | |
l_a12z | |
(Main.$sinsert_$s$sgo6 @ a1_X12s sc_s2sY arg4_a12t r_a12A); | |
GHC.Types.True -> | |
Data.Map.Base.Bin | |
@ GHC.Types.Int | |
@ a1_X12s | |
rb_a12w | |
(GHC.Types.I# sc_s2sY) | |
arg4_a12t | |
l_a12z | |
r_a12A | |
}; | |
GHC.Types.True -> | |
Data.Map.Base.balanceL | |
@ GHC.Types.Int | |
@ a1_X12s | |
wild1_s2rn | |
y_a12y | |
(Main.$sinsert_$s$sgo6 @ a1_X12s sc_s2sY arg4_a12t l_a12z) | |
r_a12A | |
} | |
}; | |
Data.Map.Base.Tip -> | |
Data.Map.Base.Bin | |
@ GHC.Types.Int | |
@ a1_X12s | |
1 | |
(GHC.Types.I# sc_s2sY) | |
arg4_a12t | |
(Data.Map.Base.Tip @ GHC.Types.Int @ a1_X12s) | |
(Data.Map.Base.Tip @ GHC.Types.Int @ a1_X12s) | |
} | |
} | |
end Rec } | |
Main.$sinsert_$sgo6 | |
:: forall a1_a12n. | |
GHC.Types.Int | |
-> a1_a12n | |
-> Data.Map.Base.Map GHC.Types.Int a1_a12n | |
-> Data.Map.Base.Map GHC.Types.Int a1_a12n | |
[GblId, | |
Arity=3, | |
Str=DmdType S(L)SS, | |
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=3, Value=True, | |
ConLike=True, WorkFree=True, Expandable=True, | |
Guidance=IF_ARGS [20 20 40] 292 120}] | |
Main.$sinsert_$sgo6 = | |
\ (@ a1_X12s) | |
(arg1_a12p :: GHC.Types.Int) | |
(arg2_a12q :: a1_X12s) | |
(ds_a12r :: Data.Map.Base.Map GHC.Types.Int a1_X12s) -> | |
case arg1_a12p of arg3_a12s { GHC.Types.I# ipv_s14m -> | |
case arg2_a12q of arg4_a12t { __DEFAULT -> | |
case ds_a12r of _ { | |
Data.Map.Base.Bin rb_a12w ky_a12x y_a12y l_a12z r_a12A -> | |
case ky_a12x of wild1_s2rn { GHC.Types.I# y#_s2rm -> | |
case GHC.Prim.<# ipv_s14m y#_s2rm of _ { | |
GHC.Types.False -> | |
case GHC.Prim.==# ipv_s14m y#_s2rm of _ { | |
GHC.Types.False -> | |
Data.Map.Base.balanceR | |
@ GHC.Types.Int | |
@ a1_X12s | |
wild1_s2rn | |
y_a12y | |
l_a12z | |
(Main.$sinsert_$s$sgo6 @ a1_X12s ipv_s14m arg4_a12t r_a12A); | |
GHC.Types.True -> | |
Data.Map.Base.Bin | |
@ GHC.Types.Int @ a1_X12s rb_a12w arg3_a12s arg4_a12t l_a12z r_a12A | |
}; | |
GHC.Types.True -> | |
Data.Map.Base.balanceL | |
@ GHC.Types.Int | |
@ a1_X12s | |
wild1_s2rn | |
y_a12y | |
(Main.$sinsert_$s$sgo6 @ a1_X12s ipv_s14m arg4_a12t l_a12z) | |
r_a12A | |
} | |
}; | |
Data.Map.Base.Tip -> | |
Data.Map.Base.Bin | |
@ GHC.Types.Int | |
@ a1_X12s | |
1 | |
arg3_a12s | |
arg4_a12t | |
(Data.Map.Base.Tip @ GHC.Types.Int @ a1_X12s) | |
(Data.Map.Base.Tip @ GHC.Types.Int @ a1_X12s) | |
} | |
} | |
} | |
Main.$sinsert | |
:: forall a_a12h. | |
GHC.Types.Int | |
-> a_a12h | |
-> Data.Map.Base.Map GHC.Types.Int a_a12h | |
-> Data.Map.Base.Map GHC.Types.Int a_a12h | |
[GblId, | |
Arity=3, | |
Str=DmdType S(L)SS, | |
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True, | |
ConLike=True, WorkFree=True, Expandable=True, | |
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=True)}] | |
Main.$sinsert = Main.$sinsert_$sgo6 | |
Rec { | |
Main.$sfromList1 [Occ=LoopBreaker] | |
:: forall a_XVx. | |
Data.Map.Base.Map GHC.Types.Int a_XVx | |
-> [(GHC.Types.Int, a_XVx)] | |
-> Data.Map.Base.Map GHC.Types.Int a_XVx | |
[GblId, Arity=2, Str=DmdType SS] | |
Main.$sfromList1 = | |
\ (@ a_XVx) | |
(z_aVz :: Data.Map.Base.Map GHC.Types.Int a_XVx) | |
(ds_aVA :: [(GHC.Types.Int, a_XVx)]) -> | |
case ds_aVA of _ { | |
[] -> z_aVz; | |
: x_aVF xs1_aVG -> | |
case x_aVF of _ { (k_aVM, x1_aVN) -> | |
case Main.$sinsert_$sgo6 @ a_XVx k_aVM x1_aVN z_aVz | |
of z'_aVP { __DEFAULT -> | |
Main.$sfromList1 @ a_XVx z'_aVP xs1_aVG | |
} | |
} | |
} | |
end Rec } | |
Main.$sfromList | |
:: forall a_aVv. | |
[(GHC.Types.Int, a_aVv)] -> Data.Map.Base.Map GHC.Types.Int a_aVv | |
[GblId, | |
Arity=1, | |
Str=DmdType S, | |
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=1, Value=True, | |
ConLike=True, WorkFree=True, Expandable=True, | |
Guidance=IF_ARGS [0] 30 0}] | |
Main.$sfromList = | |
\ (@ a_XVx) (xs_aVx :: [(GHC.Types.Int, a_XVx)]) -> | |
Main.$sfromList1 | |
@ a_XVx (Data.Map.Base.Tip @ GHC.Types.Int @ a_XVx) xs_aVx | |
Rec { | |
go_r2uI :: GHC.Prim.Int# -> [(GHC.Types.Int, GHC.Types.Int)] | |
[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType L] | |
go_r2uI = | |
\ (x_a14Z :: GHC.Prim.Int#) -> | |
let { | |
x1_aWD :: GHC.Types.Int | |
[LclId, Str=DmdType m] | |
x1_aWD = GHC.Types.I# x_a14Z } in | |
GHC.Types.: | |
@ (GHC.Types.Int, GHC.Types.Int) | |
(x1_aWD, x1_aWD) | |
(case x_a14Z of wild_Xq { | |
__DEFAULT -> go_r2uI (GHC.Prim.+# wild_Xq 1); | |
1000000 -> GHC.Types.[] @ (GHC.Types.Int, GHC.Types.Int) | |
}) | |
end Rec } | |
lvl1_r2uJ :: [(GHC.Types.Int, GHC.Types.Int)] | |
[GblId] | |
lvl1_r2uJ = go_r2uI 1 | |
m0_r2uK :: Data.Map.Base.Map GHC.Types.Int GHC.Types.Int | |
[GblId, Str=DmdType] | |
m0_r2uK = | |
Main.$sfromList1 | |
@ GHC.Types.Int | |
(Data.Map.Base.Tip @ GHC.Types.Int @ GHC.Types.Int) | |
lvl1_r2uJ | |
Rec { | |
go10_r2uL | |
:: GHC.Types.IO () | |
-> Data.Map.Base.Map GHC.Types.Int GHC.Types.Int -> GHC.Types.IO () | |
[GblId, Arity=2, Str=DmdType LS] | |
go10_r2uL = | |
\ (z'_a10K :: GHC.Types.IO ()) | |
(ds_a10L :: Data.Map.Base.Map GHC.Types.Int GHC.Types.Int) -> | |
case ds_a10L of _ { | |
Data.Map.Base.Bin rb_a10O kx_a10P x_a10Q l_a10R r_a10S -> | |
case kx_a10P of _ { GHC.Types.I# x1_s2rr -> | |
go10_r2uL | |
((\ (eta_B1 :: GHC.Prim.State# GHC.Prim.RealWorld) -> | |
case x1_s2rr of _ { | |
__DEFAULT -> | |
((go10_r2uL z'_a10K r_a10S) | |
`cast` (<GHC.Types.NTCo:IO <()>> | |
:: GHC.Types.IO () | |
~# | |
(GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)))) | |
eta_B1; | |
500000 -> | |
case GHC.IO.Handle.Text.hPutStr2 | |
GHC.IO.Handle.FD.stdout lvl_r2uH GHC.Types.True eta_B1 | |
of _ { (# ipv_a1b3, _ #) -> | |
((go10_r2uL z'_a10K r_a10S) | |
`cast` (<GHC.Types.NTCo:IO <()>> | |
:: GHC.Types.IO () | |
~# | |
(GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)))) | |
ipv_a1b3 | |
} | |
}) | |
`cast` (Sym <(GHC.Types.NTCo:IO <()>)> | |
:: (GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)) | |
~# | |
GHC.Types.IO ())) | |
l_a10R | |
}; | |
Data.Map.Base.Tip -> z'_a10K | |
} | |
end Rec } | |
lvl2_r2uM :: GHC.Types.Char | |
[GblId, Caf=NoCafRefs] | |
lvl2_r2uM = GHC.Types.C# '\n' | |
lvl3_r2uN :: [GHC.Types.Char] | |
[GblId, Caf=NoCafRefs] | |
lvl3_r2uN = | |
GHC.Types.: | |
@ GHC.Types.Char lvl2_r2uM (GHC.Types.[] @ GHC.Types.Char) | |
lvl4_r2uO | |
:: GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #) | |
[GblId, Arity=1, Caf=NoCafRefs] | |
lvl4_r2uO = | |
\ (s_X16p :: GHC.Prim.State# GHC.Prim.RealWorld) -> | |
(# s_X16p, GHC.Tuple.() #) | |
lvl5_r2uP :: [GHC.Types.Char] | |
[GblId, Caf=NoCafRefs] | |
lvl5_r2uP = | |
GHC.Types.: | |
@ GHC.Types.Char lvl2_r2uM (GHC.Types.[] @ GHC.Types.Char) | |
lvl6_r2uQ :: () | |
[GblId] | |
lvl6_r2uQ = | |
Data.Map.Base.$fNFDataMap_$crnf | |
@ GHC.Types.Int | |
@ GHC.Types.Int | |
(Control.DeepSeq.$fNFDataInt_$crnf | |
`cast` (Sym <(Control.DeepSeq.NTCo:NFData <GHC.Types.Int>)> | |
:: (GHC.Types.Int -> ()) ~# Control.DeepSeq.NFData GHC.Types.Int)) | |
(Control.DeepSeq.$fNFDataInt_$crnf | |
`cast` (Sym <(Control.DeepSeq.NTCo:NFData <GHC.Types.Int>)> | |
:: (GHC.Types.Int -> ()) ~# Control.DeepSeq.NFData GHC.Types.Int)) | |
m0_r2uK | |
Main.main1 | |
:: GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #) | |
[GblId, Arity=1, Str=DmdType L] | |
Main.main1 = | |
\ (eta_B1 :: GHC.Prim.State# GHC.Prim.RealWorld) -> | |
case Data.Time.Clock.POSIX.getPOSIXTime1 eta_B1 | |
of _ { (# ipv_a1hR, ipv1_a1hS #) -> | |
case GHC.Prim.seq# @ () @ GHC.Prim.RealWorld lvl6_r2uQ ipv_a1hR | |
of _ { (# ipv2_X1cs, _ #) -> | |
case Data.Time.Clock.POSIX.getPOSIXTime1 ipv2_X1cs | |
of _ { (# ipv4_X1jf, ipv5_X1jh #) -> | |
case {__pkg_ccall_GC base performMajorGC GHC.Prim.State# | |
GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld #)}_aWW | |
ipv4_X1jf | |
of _ { (# ds4_aWZ #) -> | |
case GHC.Stats.getGCStats1 ds4_aWZ | |
of _ { (# ipv6_X1cB, ipv7_X1cD #) -> | |
let { | |
t0_al2 [Dmd=Just D(TT)] :: Data.Time.Clock.UTC.UTCTime | |
[LclId, Str=DmdType] | |
t0_al2 = | |
case Data.Time.Clock.POSIX.$wposixSecondsToUTCTime ipv1_a1hS | |
of _ { (# ww1_a2o2, ww2_a2o3 #) -> | |
Data.Time.Clock.UTC.UTCTime ww1_a2o2 ww2_a2o3 | |
} } in | |
case GHC.IO.Handle.Text.hPutStr2 | |
GHC.IO.Handle.FD.stdout | |
(GHC.CString.unpackAppendCString# | |
"Constructed map in " | |
(case Data.Time.Clock.POSIX.$wposixSecondsToUTCTime ipv5_X1jh | |
of _ { (# ww1_a2o2, ww2_a2o3 #) -> | |
case t0_al2 of _ { Data.Time.Clock.UTC.UTCTime ww3_a2oC ww4_a2oD -> | |
GHC.Base.++ | |
@ GHC.Types.Char | |
(Data.Fixed.showFixed | |
@ Data.Fixed.E12 | |
(Data.Fixed.$fHasResolutionE12_$cresolution | |
`cast` (Sym <(Data.Fixed.NTCo:HasResolution <Data.Fixed.E12>)> | |
:: (forall (p_a211 :: * -> *). | |
p_a211 Data.Fixed.E12 -> GHC.Integer.Type.Integer) | |
~# | |
Data.Fixed.HasResolution Data.Fixed.E12)) | |
GHC.Types.True | |
((GHC.Integer.Type.minusInteger | |
(Data.Time.Clock.POSIX.$wutcTimeToPOSIXSeconds ww1_a2o2 ww2_a2o3) | |
(Data.Time.Clock.POSIX.$wutcTimeToPOSIXSeconds ww3_a2oC ww4_a2oD)) | |
`cast` (Sym <(Data.Fixed.NTCo:Fixed <Data.Fixed.E12>)> | |
:: GHC.Integer.Type.Integer ~# Data.Fixed.Fixed Data.Fixed.E12))) | |
(GHC.Types.: | |
@ GHC.Types.Char | |
Data.Time.Clock.UTC.$fShowNominalDiffTime2 | |
(GHC.CString.unpackAppendCString# | |
"\ | |
\ " | |
(GHC.Base.++ | |
@ GHC.Types.Char | |
(GHC.Stats.$w$cshowsPrec | |
0 ipv7_X1cD (GHC.Types.[] @ GHC.Types.Char)) | |
lvl5_r2uP))) | |
} | |
})) | |
GHC.Types.True | |
ipv6_X1cB | |
of _ { (# ipv8_X1cO, _ #) -> | |
case ((go10_r2uL | |
(lvl4_r2uO | |
`cast` (Sym <(GHC.Types.NTCo:IO <()>)> | |
:: (GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)) | |
~# | |
GHC.Types.IO ())) | |
m0_r2uK) | |
`cast` (<GHC.Types.NTCo:IO <()>> | |
:: GHC.Types.IO () | |
~# | |
(GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)))) | |
ipv8_X1cO | |
of _ { (# ipv10_X1cN, _ #) -> | |
case Data.Time.Clock.POSIX.getPOSIXTime1 ipv10_X1cN | |
of _ { (# ipv12_X1jz, ipv13_X1jB #) -> | |
case {__pkg_ccall_GC base performMajorGC GHC.Prim.State# | |
GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld #)}_aWW | |
ipv12_X1jz | |
of _ { (# ds9_XY1 #) -> | |
case GHC.Stats.getGCStats1 ds9_XY1 | |
of _ { (# ipv14_X1cV, ipv15_X1cX #) -> | |
case GHC.IO.Handle.Text.hPutStr2 | |
GHC.IO.Handle.FD.stdout | |
(GHC.CString.unpackAppendCString# | |
"Consumed map in " | |
(case Data.Time.Clock.POSIX.$wposixSecondsToUTCTime ipv13_X1jB | |
of _ { (# ww1_a2o2, ww2_a2o3 #) -> | |
case t0_al2 of _ { Data.Time.Clock.UTC.UTCTime ww3_a2oC ww4_a2oD -> | |
GHC.Base.++ | |
@ GHC.Types.Char | |
(Data.Fixed.showFixed | |
@ Data.Fixed.E12 | |
(Data.Fixed.$fHasResolutionE12_$cresolution | |
`cast` (Sym <(Data.Fixed.NTCo:HasResolution <Data.Fixed.E12>)> | |
:: (forall (p_a211 :: * -> *). | |
p_a211 Data.Fixed.E12 -> GHC.Integer.Type.Integer) | |
~# | |
Data.Fixed.HasResolution Data.Fixed.E12)) | |
GHC.Types.True | |
((GHC.Integer.Type.minusInteger | |
(Data.Time.Clock.POSIX.$wutcTimeToPOSIXSeconds ww1_a2o2 ww2_a2o3) | |
(Data.Time.Clock.POSIX.$wutcTimeToPOSIXSeconds ww3_a2oC ww4_a2oD)) | |
`cast` (Sym <(Data.Fixed.NTCo:Fixed <Data.Fixed.E12>)> | |
:: GHC.Integer.Type.Integer ~# Data.Fixed.Fixed Data.Fixed.E12))) | |
(GHC.Types.: | |
@ GHC.Types.Char | |
Data.Time.Clock.UTC.$fShowNominalDiffTime2 | |
(GHC.CString.unpackAppendCString# | |
"\ | |
\ " | |
(GHC.Base.++ | |
@ GHC.Types.Char | |
(GHC.Stats.$w$cshowsPrec | |
0 ipv15_X1cX (GHC.Types.[] @ GHC.Types.Char)) | |
lvl3_r2uN))) | |
} | |
})) | |
GHC.Types.True | |
ipv14_X1cV | |
of _ { (# ipv16_X1d4, _ #) -> | |
case GHC.IO.Handle.Text.hPutStr2 | |
GHC.IO.Handle.FD.stdout | |
(GHC.CString.unpackAppendCString# | |
"Bytes allocated during consume: " | |
(case ipv15_X1cX | |
of _ | |
{ GHC.Stats.GCStats rb_a11m | |
rb1_a11n | |
rb2_a11o | |
rb3_a11p | |
rb4_a11q | |
rb5_a11r | |
rb6_a11s | |
rb7_a11t | |
rb8_a11u | |
rb9_a11v | |
rb10_a11w | |
rb11_a11x | |
rb12_a11y | |
rb13_a11z | |
rb14_a11A | |
rb15_a11B | |
rb16_a11C | |
rb17_a11D -> | |
case ipv7_X1cD | |
of _ | |
{ GHC.Stats.GCStats rb18_X12X | |
rb19_X12Z | |
rb20_X131 | |
rb21_X133 | |
rb22_X135 | |
rb23_X137 | |
rb24_X139 | |
rb25_X13b | |
rb26_X13d | |
rb27_X13f | |
rb28_X13h | |
rb29_X13j | |
rb30_X13l | |
rb31_X13n | |
rb32_X13p | |
rb33_X13r | |
rb34_X13t | |
rb35_X13v -> | |
GHC.Show.itos | |
(GHC.Prim.-# rb_a11m rb18_X12X) (GHC.Types.[] @ GHC.Types.Char) | |
} | |
})) | |
GHC.Types.True | |
ipv16_X1d4 | |
of _ { (# ipv18_X1d3, _ #) -> | |
(# ipv18_X1d3, GHC.Tuple.() #) | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
Main.main :: GHC.Types.IO () | |
[GblId, | |
Arity=1, | |
Str=DmdType L, | |
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True, | |
ConLike=True, WorkFree=True, Expandable=True, | |
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=True)}] | |
Main.main = | |
Main.main1 | |
`cast` (Sym <(GHC.Types.NTCo:IO <()>)> | |
:: (GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)) | |
~# | |
GHC.Types.IO ()) | |
Main.main2 | |
:: GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #) | |
[GblId, | |
Arity=1, | |
Str=DmdType L, | |
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=1, Value=True, | |
ConLike=True, WorkFree=True, Expandable=True, | |
Guidance=IF_ARGS [0] 30 0}] | |
Main.main2 = | |
\ (eta_Xb :: GHC.Prim.State# GHC.Prim.RealWorld) -> | |
GHC.TopHandler.runMainIO1 | |
@ () | |
(Main.main1 | |
`cast` (Sym <(GHC.Types.NTCo:IO <()>)> | |
:: (GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)) | |
~# | |
GHC.Types.IO ())) | |
eta_Xb | |
:Main.main :: GHC.Types.IO () | |
[GblId, | |
Arity=1, | |
Str=DmdType L, | |
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True, | |
ConLike=True, WorkFree=True, Expandable=True, | |
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=True)}] | |
:Main.main = | |
Main.main2 | |
`cast` (Sym <(GHC.Types.NTCo:IO <()>)> | |
:: (GHC.Prim.State# GHC.Prim.RealWorld | |
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)) | |
~# | |
GHC.Types.IO ()) | |
------ Local rules for imported ids -------- | |
"SPEC Data.Map.Strict.insert [GHC.Types.Int]" [ALWAYS] | |
forall (@ a_a12h) ($dOrd_s14b :: GHC.Classes.Ord GHC.Types.Int). | |
Data.Map.Strict.insert @ GHC.Types.Int @ a_a12h $dOrd_s14b | |
= Main.$sinsert @ a_a12h | |
"SPEC Data.Map.Strict.fromList [GHC.Types.Int]" [ALWAYS] | |
forall (@ a_aVv) ($dOrd_s14a :: GHC.Classes.Ord GHC.Types.Int). | |
Data.Map.Strict.fromList @ GHC.Types.Int @ a_aVv $dOrd_s14a | |
= Main.$sfromList @ a_aVv | |
"SC:$sgo60" [ALWAYS] | |
forall (@ a1_X12s) | |
(sc_s2sY :: GHC.Prim.Int#) | |
(sc1_s2sZ :: a1_X12s) | |
(sc2_s2t0 :: Data.Map.Base.Map GHC.Types.Int a1_X12s). | |
Main.$sinsert_$sgo6 @ a1_X12s | |
(GHC.Types.I# sc_s2sY) | |
sc1_s2sZ | |
sc2_s2t0 | |
= Main.$sinsert_$s$sgo6 @ a1_X12s sc_s2sY sc1_s2sZ sc2_s2t0 |
This file contains hidden or 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
import Control.DeepSeq | |
import GHC.Stats | |
import qualified Data.Map.Strict as M | |
import Data.Time.Clock | |
import Control.Exception | |
import System.Mem | |
main :: IO () | |
main = do | |
t0 <- getCurrentTime | |
let m0 = M.fromList (map (\i -> (i,i)) [1..1000000::Int]) | |
evaluate$ rnf m0 | |
t1 <- getCurrentTime | |
performGC | |
s1 <- getGCStats | |
putStrLn$"Constructed map in "++show (diffUTCTime t1 t0)++"\n "++ show s1++"\n" | |
let fn 500000 v = putStrLn "Got it!" | |
fn _ _ = return () | |
-- Regular traverseWithKey uses 48MB | |
-- traverseWithKey_ usse 200K of allocation: | |
M.traverseWithKey_ fn m0 | |
t2 <- getCurrentTime | |
performGC | |
s2 <- getGCStats | |
putStrLn$"[traverseWithKey_] Consumed map in "++show (diffUTCTime t2 t1)++"\n "++ show s2++"\n" | |
putStrLn$"Bytes allocated during consume: "++show (bytesAllocated s2 - bytesAllocated s1) | |
-- foldrWithKey uses 32MB allocation: | |
M.foldrWithKey (\k a -> (fn k a >>)) (return ()) m0 | |
t3 <- getCurrentTime | |
performGC | |
s3 <- getGCStats | |
putStrLn$"[foldrWithKey] Consumed map in "++show (diffUTCTime t3 t2)++"\n "++ show s3++"\n" | |
putStrLn$"Bytes allocated during consume: "++show (bytesAllocated s3 - bytesAllocated s2) | |
return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment