Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RULES for Data.IntMap.alterF #467

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Commits on Dec 23, 2017

  1. Configuration menu
    Copy the full SHA
    f437af1 View commit details
    Browse the repository at this point in the history

Commits on Dec 24, 2017

  1. Configuration menu
    Copy the full SHA
    091a82d View commit details
    Browse the repository at this point in the history

Commits on Dec 29, 2017

  1. Configuration menu
    Copy the full SHA
    b70c8a1 View commit details
    Browse the repository at this point in the history
  2. Add property test for alterF rules.

    These ensure that the rewritten rules perform the same as the non-rewritten counterparts.
    m-renaud committed Dec 29, 2017
    Configuration menu
    Copy the full SHA
    75961b5 View commit details
    Browse the repository at this point in the history
  3. Add benchmarks for alterF rewrite rules.

    Benchmark results:
    
    benchmarking alter
    time                 698.5 μs   (676.3 μs .. 726.1 μs)
                         0.994 R²   (0.991 R² .. 0.999 R²)
    mean                 674.8 μs   (668.6 μs .. 686.6 μs)
    std dev              28.63 μs   (14.53 μs .. 45.31 μs)
    variance introduced by outliers: 34% (moderately inflated)
    
    benchmarking alterF
    time                 969.5 μs   (962.1 μs .. 977.3 μs)
                         1.000 R²   (0.999 R² .. 1.000 R²)
    mean                 956.7 μs   (952.8 μs .. 961.1 μs)
    std dev              13.98 μs   (11.21 μs .. 17.72 μs)
    
    benchmarking alterFIdentity
    time                 660.7 μs   (654.5 μs .. 673.4 μs)
                         0.994 R²   (0.990 R² .. 0.997 R²)
    mean                 674.1 μs   (660.4 μs .. 691.3 μs)
    std dev              49.44 μs   (38.40 μs .. 57.64 μs)
    variance introduced by outliers: 61% (severely inflated)
    
    benchmarking alterFConst
    time                 14.98 μs   (13.94 μs .. 16.02 μs)
                         0.976 R²   (0.972 R² .. 0.990 R²)
    mean                 15.12 μs   (14.57 μs .. 15.84 μs)
    std dev              2.104 μs   (1.813 μs .. 2.236 μs)
    variance introduced by outliers: 92% (severely inflated)
    m-renaud committed Dec 29, 2017
    Configuration menu
    Copy the full SHA
    c1bedde View commit details
    Browse the repository at this point in the history

Commits on Dec 30, 2017

  1. Remove uses of Applicative and pure.

    This causes errors on older versions of GHC.
    
    https://travis-ci.org/haskell/containers/jobs/323051426
    m-renaud committed Dec 30, 2017
    Configuration menu
    Copy the full SHA
    85dafee View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f3f7a27 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4ffbc19 View commit details
    Browse the repository at this point in the history

Commits on Dec 31, 2017

  1. Configuration menu
    Copy the full SHA
    2ea64a8 View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2018

  1. Configuration menu
    Copy the full SHA
    cfc3730 View commit details
    Browse the repository at this point in the history

Commits on Jan 8, 2018

  1. Organize benchmarks into NoRewrite and Rewrite.

    Results:
    
    benchmarking alterF_IdentityNoRewrite
    time                 1.177 ms   (1.171 ms .. 1.184 ms)
                         1.000 R²   (0.999 R² .. 1.000 R²)
    mean                 1.162 ms   (1.156 ms .. 1.169 ms)
    std dev              20.18 μs   (16.39 μs .. 26.88 μs)
    
    benchmarking alterF_IdentityRewrite
    time                 818.9 μs   (814.4 μs .. 823.2 μs)
                         1.000 R²   (0.999 R² .. 1.000 R²)
    mean                 808.8 μs   (804.7 μs .. 815.8 μs)
    std dev              17.13 μs   (10.29 μs .. 26.35 μs)
    variance introduced by outliers: 11% (moderately inflated)
    
    benchmarking alterF_ConstNoRewrite
    time                 63.80 μs   (62.22 μs .. 65.81 μs)
                         0.996 R²   (0.993 R² .. 1.000 R²)
    mean                 62.13 μs   (61.61 μs .. 63.07 μs)
    std dev              2.440 μs   (1.271 μs .. 4.050 μs)
    variance introduced by outliers: 42% (moderately inflated)
    
    benchmarking alterF_ConstRewrite
    time                 17.24 μs   (16.35 μs .. 18.38 μs)
                         0.979 R²   (0.974 R² .. 0.990 R²)
    mean                 17.92 μs   (17.18 μs .. 18.71 μs)
    std dev              2.446 μs   (2.125 μs .. 2.578 μs)
    variance introduced by outliers: 92% (severely inflated)
    m-renaud committed Jan 8, 2018
    Configuration menu
    Copy the full SHA
    08e1b1f View commit details
    Browse the repository at this point in the history
  2. Make alterF to INLINEABLE.

    This improves the Const benchmark for the non-rewritten case:
    
    Before
    ======
    
    benchmarking alterF_IdentityNoRewrite
    time                 1.177 ms   (1.171 ms .. 1.184 ms)
                         1.000 R²   (0.999 R² .. 1.000 R²)
    mean                 1.162 ms   (1.156 ms .. 1.169 ms)
    std dev              20.18 μs   (16.39 μs .. 26.88 μs)
    
    benchmarking alterF_IdentityRewrite
    time                 818.9 μs   (814.4 μs .. 823.2 μs)
                         1.000 R²   (0.999 R² .. 1.000 R²)
    mean                 808.8 μs   (804.7 μs .. 815.8 μs)
    std dev              17.13 μs   (10.29 μs .. 26.35 μs)
    variance introduced by outliers: 11% (moderately inflated)
    
    benchmarking alterF_ConstNoRewrite
    time                 63.80 μs   (62.22 μs .. 65.81 μs)
                         0.996 R²   (0.993 R² .. 1.000 R²)
    mean                 62.13 μs   (61.61 μs .. 63.07 μs)
    std dev              2.440 μs   (1.271 μs .. 4.050 μs)
    variance introduced by outliers: 42% (moderately inflated)
    
    benchmarking alterF_ConstRewrite
    time                 17.24 μs   (16.35 μs .. 18.38 μs)
                         0.979 R²   (0.974 R² .. 0.990 R²)
    mean                 17.92 μs   (17.18 μs .. 18.71 μs)
    std dev              2.446 μs   (2.125 μs .. 2.578 μs)
    variance introduced by outliers: 92% (severely inflated)
    
    After
    =====
    
    benchmarking alterF_IdentityNoRewrite
    time                 1.134 ms   (1.116 ms .. 1.151 ms)
                         0.998 R²   (0.997 R² .. 0.999 R²)
    mean                 1.100 ms   (1.092 ms .. 1.112 ms)
    std dev              31.57 μs   (25.08 μs .. 46.04 μs)
    variance introduced by outliers: 17% (moderately inflated)
    
    benchmarking alterF_IdentityRewrite
    time                 849.4 μs   (844.1 μs .. 853.8 μs)
                         1.000 R²   (0.999 R² .. 1.000 R²)
    mean                 836.1 μs   (831.8 μs .. 841.5 μs)
    std dev              15.55 μs   (11.92 μs .. 24.54 μs)
    
    benchmarking alterF_ConstNoRewrite
    time                 21.12 μs   (20.26 μs .. 21.66 μs)
                         0.992 R²   (0.983 R² .. 0.999 R²)
    mean                 20.71 μs   (19.90 μs .. 21.08 μs)
    std dev              1.685 μs   (953.0 ns .. 2.410 μs)
    variance introduced by outliers: 79% (severely inflated)
    
    benchmarking alterF_ConstRewrite
    time                 17.04 μs   (16.48 μs .. 18.07 μs)
                         0.977 R²   (0.969 R² .. 0.987 R²)
    mean                 18.76 μs   (17.82 μs .. 19.84 μs)
    std dev              3.275 μs   (2.764 μs .. 3.809 μs)
    variance introduced by outliers: 95% (severely inflated)
    
    [ci skip]
    m-renaud committed Jan 8, 2018
    Configuration menu
    Copy the full SHA
    2564074 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'master' into alterf-rules

    [ci skip]
    m-renaud committed Jan 8, 2018
    Configuration menu
    Copy the full SHA
    482dfc8 View commit details
    Browse the repository at this point in the history
  4. make prop_alterF_IdentityRules a property.

    This also checks that the two results are 'valid'.
    m-renaud committed Jan 8, 2018
    Configuration menu
    Copy the full SHA
    d400df5 View commit details
    Browse the repository at this point in the history
  5. Undo unintentional change to stack.yaml.

    [ci skip]
    m-renaud committed Jan 8, 2018
    Configuration menu
    Copy the full SHA
    fd5d2dc View commit details
    Browse the repository at this point in the history
  6. INLINABLE, not INLINEABLE.

    Both spellings work but the docs use "INLINABLE".
    
    [ci skip]
    m-renaud committed Jan 8, 2018
    Configuration menu
    Copy the full SHA
    e19a556 View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2018

  1. Configuration menu
    Copy the full SHA
    8fd1b25 View commit details
    Browse the repository at this point in the history
  2. Add more granular benchmarks.

    These benchmarks tell a different story from the previous
    benchmarks. Specifically, the rewritten alterF for Identity appears to perform
    better in casses when the element being altered is present, but worse when the
    element is absent. Specifically:
      better for: "benchmarking alterF delete present"
      	      "benchmarking alterF alter insert"
    	      "benchmarking alterF alter update"
    	      "benchmarking alterF alter delete"
      worse for:  "benchmarking alterF delete absent"
      	      "benchmarking alterF alter absent"
    
    Benchmark Results:
    
    benchmarking alterF lookup absent
    time                 123.7 μs   (123.4 μs .. 124.0 μs)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 123.2 μs   (122.8 μs .. 124.0 μs)
    std dev              1.702 μs   (961.3 ns .. 2.891 μs)
    
    benchmarking alterF lookup present
    time                 126.9 μs   (125.4 μs .. 129.2 μs)
                         0.999 R²   (0.998 R² .. 1.000 R²)
    mean                 127.0 μs   (126.4 μs .. 128.3 μs)
    std dev              2.608 μs   (1.219 μs .. 4.415 μs)
    variance introduced by outliers: 15% (moderately inflated)
    
    benchmarking alterF no rules lookup absent
    time                 123.1 μs   (122.7 μs .. 123.6 μs)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 122.7 μs   (122.3 μs .. 123.4 μs)
    std dev              1.738 μs   (1.162 μs .. 2.847 μs)
    
    benchmarking alterF no rules lookup present
    time                 125.5 μs   (125.0 μs .. 126.1 μs)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 125.3 μs   (124.8 μs .. 126.3 μs)
    std dev              2.381 μs   (1.366 μs .. 4.219 μs)
    variance introduced by outliers: 13% (moderately inflated)
    
    benchmarking alterF insert absent
    time                 286.4 μs   (283.2 μs .. 291.0 μs)
                         0.996 R²   (0.992 R² .. 0.999 R²)
    mean                 285.4 μs   (281.3 μs .. 292.4 μs)
    std dev              16.74 μs   (10.04 μs .. 23.84 μs)
    variance introduced by outliers: 55% (severely inflated)
    
    benchmarking alterF insert present
    time                 268.8 μs   (266.0 μs .. 273.2 μs)
                         0.999 R²   (0.997 R² .. 1.000 R²)
    mean                 266.6 μs   (264.5 μs .. 272.0 μs)
    std dev              10.35 μs   (3.766 μs .. 21.79 μs)
    variance introduced by outliers: 35% (moderately inflated)
    
    benchmarking alterF no rules insert absent
    time                 278.2 μs   (275.3 μs .. 282.1 μs)
                         0.999 R²   (0.999 R² .. 1.000 R²)
    mean                 274.2 μs   (273.0 μs .. 276.4 μs)
    std dev              4.920 μs   (3.263 μs .. 7.465 μs)
    variance introduced by outliers: 11% (moderately inflated)
    
    benchmarking alterF no rules insert present
    time                 263.8 μs   (262.9 μs .. 264.9 μs)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 261.2 μs   (260.4 μs .. 262.3 μs)
    std dev              3.298 μs   (2.541 μs .. 4.858 μs)
    
    benchmarking alterF delete absent
    time                 229.7 μs   (228.4 μs .. 232.3 μs)
                         0.995 R²   (0.986 R² .. 0.999 R²)
    mean                 234.9 μs   (230.4 μs .. 244.7 μs)
    std dev              21.96 μs   (11.47 μs .. 39.15 μs)
    variance introduced by outliers: 77% (severely inflated)
    
    benchmarking alterF delete present
    time                 263.6 μs   (263.0 μs .. 264.4 μs)
                         0.999 R²   (0.998 R² .. 1.000 R²)
    mean                 264.2 μs   (261.9 μs .. 268.9 μs)
    std dev              10.23 μs   (2.598 μs .. 17.63 μs)
    variance introduced by outliers: 35% (moderately inflated)
    
    benchmarking alterF no rules delete absent
    time                 121.0 μs   (120.6 μs .. 121.4 μs)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 120.6 μs   (120.1 μs .. 122.3 μs)
    std dev              2.556 μs   (872.5 ns .. 5.536 μs)
    variance introduced by outliers: 15% (moderately inflated)
    
    benchmarking alterF no rules delete present
    time                 375.4 μs   (373.4 μs .. 377.8 μs)
                         0.998 R²   (0.995 R² .. 1.000 R²)
    mean                 377.0 μs   (372.5 μs .. 394.4 μs)
    std dev              24.73 μs   (3.491 μs .. 49.28 μs)
    variance introduced by outliers: 60% (severely inflated)
    
    benchmarking alterF alter absent
    time                 241.9 μs   (235.2 μs .. 251.3 μs)
                         0.994 R²   (0.990 R² .. 1.000 R²)
    mean                 237.5 μs   (234.9 μs .. 242.1 μs)
    std dev              10.98 μs   (5.881 μs .. 16.30 μs)
    variance introduced by outliers: 44% (moderately inflated)
    
    benchmarking alterF alter insert
    time                 265.0 μs   (263.4 μs .. 267.1 μs)
                         0.997 R²   (0.994 R² .. 0.999 R²)
    mean                 274.0 μs   (267.5 μs .. 283.6 μs)
    std dev              25.20 μs   (18.18 μs .. 33.32 μs)
    variance introduced by outliers: 76% (severely inflated)
    
    benchmarking alterF alter update
    time                 260.8 μs   (253.6 μs .. 270.1 μs)
                         0.996 R²   (0.992 R² .. 1.000 R²)
    mean                 254.8 μs   (252.4 μs .. 258.6 μs)
    std dev              9.796 μs   (5.279 μs .. 15.32 μs)
    variance introduced by outliers: 35% (moderately inflated)
    
    benchmarking alterF alter delete
    time                 263.9 μs   (262.8 μs .. 265.6 μs)
                         1.000 R²   (0.999 R² .. 1.000 R²)
    mean                 262.8 μs   (261.7 μs .. 265.0 μs)
    std dev              4.963 μs   (2.882 μs .. 8.375 μs)
    variance introduced by outliers: 12% (moderately inflated)
    
    benchmarking alterF no rules alter absent
    time                 142.6 μs   (137.4 μs .. 148.4 μs)
                         0.991 R²   (0.988 R² .. 0.996 R²)
    mean                 137.5 μs   (135.2 μs .. 141.0 μs)
    std dev              9.531 μs   (6.703 μs .. 12.40 μs)
    variance introduced by outliers: 67% (severely inflated)
    
    benchmarking alterF no rules alter insert
    time                 293.5 μs   (291.7 μs .. 295.5 μs)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 291.1 μs   (289.8 μs .. 293.1 μs)
    std dev              5.100 μs   (3.695 μs .. 7.448 μs)
    
    benchmarking alterF no rules alter update
    time                 409.7 μs   (407.8 μs .. 412.1 μs)
                         1.000 R²   (1.000 R² .. 1.000 R²)
    mean                 406.3 μs   (404.4 μs .. 408.4 μs)
    std dev              6.193 μs   (5.148 μs .. 7.883 μs)
    
    benchmarking alterF no rules alter delete
    time                 388.3 μs   (386.0 μs .. 391.0 μs)
                         1.000 R²   (0.999 R² .. 1.000 R²)
    mean                 386.6 μs   (384.5 μs .. 396.3 μs)
    std dev              12.23 μs   (3.727 μs .. 26.30 μs)
    variance introduced by outliers: 25% (moderately inflated)
    m-renaud committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    164ef90 View commit details
    Browse the repository at this point in the history