IntSet's minView and maxView creates unwanted thunks
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
Research direction
Start with minView and maxView in containers/src/Data/IntSet/Internal.hs at the linked lines, then compare their definitions with the corresponding IntMap code in containers/src/Data/IntMap/Internal.hs. Generate Core for the affected functions and verify that using the stricter result representation removes the unwanted thunks while preserving the existing IntSet behavior.
Written by the indexing model from the issue text.
Description
Core:
Rec {
-- RHS size: {terms: 47, types: 28, coercions: 0, joins: 0/1}
$wgo1 [InlPrag=[2], Occ=LoopBreaker] :: IntSet -> (# Int, IntSet #)
[GblId[StrictWorker([!])], Arity=1, Str=<1L>, Unf=OtherCon []]
$wgo1
= \ (ds_sdOH :: IntSet) ->
case ds_sdOH of {
Bin bx_dcyn l_a73T r_a73U ->
case $wgo1 r_a73U of { (# ww_se6X, ww1_se6Y #) ->
(# ww_se6X,
case ww1_se6Y of wild2_X4 {
__DEFAULT -> Bin bx_dcyn l_a73T wild2_X4;
Nil -> l_a73T
} #)
};
Tip bx_dcyp bx1_dcyq ->
let {
bi_sd64 :: Int#
[LclId]
bi_sd64 = -# 63# (word2Int# (clz# bx1_dcyq)) } in
(# I# (+# bx_dcyp bi_sd64),
case and# bx1_dcyq (not# (uncheckedShiftL# 1## bi_sd64))
of ds1_X3 {
__DEFAULT -> Tip bx_dcyp ds1_X3;
0## -> Nil
} #);
Nil -> case lvl42_reKj of {}
}
Just using a strict pair instead of lazy should fix it. IntMap's definition seems pretty good and how I would define it for IntSet too, splitting the empty map case out and inlining it to potentially get rid of the Maybe.
- Dominant language
- Haskell
- Stars
- 356
- Forks
- 196
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from haskell/containers
-
major-release strictness Tree
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
haskell/containers#1260 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
haskell/containers#1266 · 7 comments ·
-
IntMap IntSet Map performance
Difficulty 4/5 3-5 days Newbie friendliness 45/100
haskell/containers#1265 · 2 comments ·
-
Map performance Set
Difficulty 5/5 Over a week Newbie friendliness 35/100
haskell/containers#1263 · 5 comments ·
-
low-hanging-fruit performance Seq
Difficulty 4/5 3-5 days Newbie friendliness 43/100
haskell/containers#1262 · 2 comments ·
All issues in haskell/containers
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
objectionary/phino#2059 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
NixOS/nixpkgs-update#586 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
wireapp/wire-server#5632 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100