[commit: packages/containers] cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394: Sequences: strictify adjust; reimplement update (fc8c1aa)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:43:11 UTC 2017


Repository : ssh://git@git.haskell.org/containers

On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394
Link       : http://git.haskell.org/packages/containers.git/commitdiff/fc8c1aadf43220a6db5728cec9a3b4551ee83228

>---------------------------------------------------------------

commit fc8c1aadf43220a6db5728cec9a3b4551ee83228
Author: David Feuer <David.Feuer at gmail.com>
Date:   Tue May 31 09:55:52 2016 -0400

    Sequences: strictify adjust; reimplement update
    
    Previously, `adjust` would place a thunk at the top of the tree.
    Now, it pushes that thunk all the way down to the appropriate
    leaf. This way, performing multiple adjustments to different
    locations will not lead to a thunk clog at the top.
    
    Adjusting the *same* location many times, however, can lead to
    a thunk clog at the leaf. This is generally unavoidable. `update`
    used to be implemented as
    
    ```haskell
    update i x = adjust (const x) i
    ```
    
    which is subject to the thunk clog problem. By implementing the
    `Elem` layer of `update` directly (duplicating code), we can
    avoid subjecting `update` to this problem at all.
    
    Also, bring all the insertion code together. It got separated
    by mistake.
    
    Actually export `alterF` from `Data.IntMap.Strict`.


>---------------------------------------------------------------

fc8c1aadf43220a6db5728cec9a3b4551ee83228
 Data/IntMap/Strict.hs  |   1 +
 Data/Sequence.hs       | 305 +++++++++++++++++++++++++++++++------------------
 benchmarks/Sequence.hs |  26 +++++
 3 files changed, 222 insertions(+), 110 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc fc8c1aadf43220a6db5728cec9a3b4551ee83228


More information about the ghc-commits mailing list