You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we try to be very efficient about lists that ascend from the start for most of their length. This seems a tad specific. I suspect what we'd really like to use is an algorithm more like that of Data.List.sort. That is, break up the input into ascending and descending segments, convert each segment, and use union to join the segments together. Unfortunately, the current code is not structured in a way that makes this terribly easy.
Another (less serious) problem is that fromAscListWithKey and fromDescListWithKey preprocess their input lists to squash duplicates. When there aren't any duplicates, this allocates a bunch of short-lived conses. It would be nice to find a way to avoid this, but it's probably not terribly important. I made a brief attempt, but it got horrible pretty quickly.
Another (more serious?) problem is that Data.Map.fromAscList is defined in terms of fromAscListWithKey, which in the lazy case seems rather likely to produce an avoidable space leak. (Fixed in #332)
The text was updated successfully, but these errors were encountered:
-- More complicated implementations are possible, such as repeatedly
-- accumulating runs of increasing elements in Stacks (not just once) and
-- union-ing with an accumulated Set, but this makes the worst case somewhat
-- slower (~10%).
Another (less serious) problem is that fromAscListWithKey and fromDescListWithKey preprocess their input lists to squash duplicates. When there aren't any duplicates, this allocates a bunch of short-lived conses.
Currently, we try to be very efficient about lists that ascend from the start for most of their length. This seems a tad specific. I suspect what we'd really like to use is an algorithm more like that of
Data.List.sort
. That is, break up the input into ascending and descending segments, convert each segment, and useunion
to join the segments together. Unfortunately, the current code is not structured in a way that makes this terribly easy.Another (less serious) problem is that
fromAscListWithKey
andfromDescListWithKey
preprocess their input lists to squash duplicates. When there aren't any duplicates, this allocates a bunch of short-lived conses. It would be nice to find a way to avoid this, but it's probably not terribly important. I made a brief attempt, but it got horrible pretty quickly.Another (more serious?) problem is that(Fixed in #332)Data.Map.fromAscList
is defined in terms offromAscListWithKey
, which in the lazy case seems rather likely to produce an avoidable space leak.The text was updated successfully, but these errors were encountered: