[commit: packages/containers] master: Reimplement `<*>` (38b1b81)

git at git.haskell.org git at git.haskell.org
Fri Jan 23 22:43:32 UTC 2015


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

On branch  : master
Link       : http://git.haskell.org/packages/containers.git/commitdiff/38b1b81c8b5536525d0daad9bd8ee9821a3fb929

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

commit 38b1b81c8b5536525d0daad9bd8ee9821a3fb929
Author: David Feuer <David.Feuer at gmail.com>
Date:   Thu Dec 18 16:31:10 2014 -0500

    Reimplement `<*>`
    
    Use `coerce` for the `Functor` instance of `Elem`
    
    Using `fmap = coerce` for `Elem` speeds up `<*>` by somewhere
    around 20%.
    
    Benchmark results:
    
    OLD:
    
    benchmarking <*>/ix1000/500000
    time                 11.47 ms   (11.37 ms .. 11.59 ms)
                         0.999 R²   (0.998 R² .. 1.000 R²)
    mean                 11.61 ms   (11.52 ms .. 11.73 ms)
    std dev              279.9 μs   (209.5 μs .. 385.6 μs)
    
    benchmarking <*>/nf100/2500/rep
    time                 8.530 ms   (8.499 ms .. 8.568 ms)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 8.511 ms   (8.498 ms .. 8.528 ms)
    std dev              40.40 μs   (28.55 μs .. 63.84 μs)
    
    benchmarking <*>/nf100/2500/ff
    time                 27.13 ms   (26.16 ms .. 28.70 ms)
                         0.994 R²   (0.988 R² .. 1.000 R²)
    mean                 26.49 ms   (26.29 ms .. 27.43 ms)
    std dev              697.1 μs   (153.0 μs .. 1.443 ms)
    
    benchmarking <*>/nf500/500/rep
    time                 8.421 ms   (8.331 ms .. 8.491 ms)
                         0.991 R²   (0.967 R² .. 1.000 R²)
    mean                 8.518 ms   (8.417 ms .. 9.003 ms)
    std dev              529.9 μs   (40.37 μs .. 1.176 ms)
    variance introduced by outliers: 32% (moderately inflated)
    
    benchmarking <*>/nf500/500/ff
    time                 33.71 ms   (33.58 ms .. 33.86 ms)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 33.69 ms   (33.62 ms .. 33.76 ms)
    std dev              150.0 μs   (119.0 μs .. 191.0 μs)
    
    benchmarking <*>/nf2500/100/rep
    time                 8.390 ms   (8.259 ms .. 8.456 ms)
                         0.997 R²   (0.992 R² .. 1.000 R²)
    mean                 8.544 ms   (8.441 ms .. 8.798 ms)
    std dev              402.6 μs   (21.25 μs .. 714.9 μs)
    variance introduced by outliers: 23% (moderately inflated)
    
    benchmarking <*>/nf2500/100/ff
    time                 53.69 ms   (53.33 ms .. 54.08 ms)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 53.59 ms   (53.38 ms .. 53.75 ms)
    std dev              341.2 μs   (231.7 μs .. 473.9 μs)
    
    NEW
    
    benchmarking <*>/ix1000/500000
    time                 2.688 μs   (2.607 μs .. 2.798 μs)
                         0.994 R²   (0.988 R² .. 1.000 R²)
    mean                 2.632 μs   (2.607 μs .. 2.715 μs)
    std dev              129.9 ns   (65.93 ns .. 242.8 ns)
    variance introduced by outliers: 64% (severely inflated)
    
    benchmarking <*>/nf100/2500/rep
    time                 8.371 ms   (8.064 ms .. 8.535 ms)
                         0.983 R²   (0.947 R² .. 1.000 R²)
    mean                 8.822 ms   (8.590 ms .. 9.463 ms)
    std dev              991.2 μs   (381.3 μs .. 1.809 ms)
    variance introduced by outliers: 61% (severely inflated)
    
    benchmarking <*>/nf100/2500/ff
    time                 22.84 ms   (22.74 ms .. 22.94 ms)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 22.78 ms   (22.71 ms .. 22.86 ms)
    std dev              183.3 μs   (116.3 μs .. 291.3 μs)
    
    benchmarking <*>/nf500/500/rep
    time                 8.320 ms   (8.102 ms .. 8.514 ms)
                         0.995 R²   (0.990 R² .. 0.999 R²)
    mean                 8.902 ms   (8.675 ms .. 9.407 ms)
    std dev              952.4 μs   (435.5 μs .. 1.672 ms)
    variance introduced by outliers: 58% (severely inflated)
    
    benchmarking <*>/nf500/500/ff
    time                 24.50 ms   (24.41 ms .. 24.58 ms)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 24.44 ms   (24.41 ms .. 24.48 ms)
    std dev              75.08 μs   (50.16 μs .. 111.3 μs)
    
    benchmarking <*>/nf2500/100/rep
    time                 8.419 ms   (8.366 ms .. 8.458 ms)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 8.571 ms   (8.525 ms .. 8.670 ms)
    std dev              179.5 μs   (112.0 μs .. 278.1 μs)
    
    benchmarking <*>/nf2500/100/ff
    time                 24.14 ms   (24.07 ms .. 24.26 ms)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 24.11 ms   (24.07 ms .. 24.17 ms)
    std dev              103.8 μs   (68.34 μs .. 142.0 μs)


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

38b1b81c8b5536525d0daad9bd8ee9821a3fb929
 Data/Sequence.hs | 261 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 258 insertions(+), 3 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 38b1b81c8b5536525d0daad9bd8ee9821a3fb929


More information about the ghc-commits mailing list