Order of tests in rem and friends

Roman Leshchinskiy rl at cse.unsw.edu.au
Sun Mar 28 02:04:56 EDT 2010


Following the discussion in haskell-cafe, I tried changing the order of tests in the Integral methods from:

    a `rem` b
     | b == 0                     = divZeroError
     | a == minBound && b == (-1) = overflowError
     | otherwise                  =  a `remInt` b

to

    a `rem` b
     | b == 0                     = divZeroError
     | b == (-1) && a == minBound = overflowError
     | otherwise                  =  a `remInt` b

for the various Int instances in base/GHC/Real.lhs and base/GHC/Int.lhs. The nofib results are below. Would it be ok to push the patch? I suspect the runtime differences aren't significant but I can investigate if necessary.

Roman

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed
--------------------------------------------------------------------------------
           anna          -0.1%     -0.0%      0.08      0.10
           ansi          -0.2%     +0.0%      0.00      0.01
           atom          -0.2%     +0.0%      0.20     +0.0%
         awards          -0.2%     +0.0%      0.00      0.01
         banner          -0.2%     +0.0%      0.00      0.01
     bernouilli          +0.0%     +0.0%     +0.0%     -1.0%
          boyer          -0.2%     +0.0%      0.03      0.04
         boyer2          -0.2%     +0.0%      0.00      0.01
           bspt          -0.2%     +0.0%      0.00      0.02
      cacheprof          -0.2%     +0.0%     -0.5%     -0.4%
       calendar          -0.2%     -0.1%      0.00      0.02
       cichelli          +0.0%     -0.0%      0.07      0.08
        circsim          -0.2%     +0.0%     +0.3%     +0.5%
       clausify          +0.0%     +0.0%      0.03      0.04
  comp_lab_zift          -0.2%     +0.0%      0.17      0.18
       compress          -0.2%     -0.1%      0.15      0.17
      compress2          +0.0%     +0.0%      0.14      0.16
    constraints          -0.2%     +0.0%     +0.7%     +0.9%
   cryptarithm1          -0.2%     +0.0%     -1.1%     -1.0%
   cryptarithm2          +0.0%     +0.0%      0.01      0.02
            cse          +0.0%     +0.0%      0.00      0.01
          eliza          -0.2%     +0.0%      0.00      0.01
          event          -0.3%     -1.2%      0.13      0.14
         exp3_8          -0.2%     +0.0%      0.10      0.12
         expert          -0.2%     +0.0%      0.00      0.02
            fem          -0.2%     +0.0%      0.02      0.03
            fft          -0.2%     -0.1%      0.03      0.04
           fft2          -0.3%     +0.0%      0.06      0.07
       fibheaps          -0.2%     +0.0%      0.03      0.04
           fish          +0.0%     -4.9%      0.02      0.03
          fluid          -0.2%     +0.0%      0.01      0.02
         fulsom          +0.0%     -0.1%     +4.6%     +0.9%
         gamteb          +0.0%     -0.0%      0.07      0.09
            gcd          +0.0%     +0.0%      0.02      0.03
    gen_regexps          +0.0%     +0.0%      0.00      0.01
         genfft          -0.2%     +0.0%      0.03      0.04
             gg          -0.2%     +0.0%      0.01      0.02
           grep          +0.0%     +0.0%      0.00      0.01
         hidden          -0.2%     +0.0%     -2.4%     +0.9%
            hpg          -0.2%     +0.0%      0.19     +3.2%
            ida          -0.2%     +0.0%      0.09      0.10
          infer          -0.4%     +0.0%      0.04      0.05
        integer          -0.2%     +0.0%     -1.0%     -1.4%
      integrate          -0.4%     +0.0%     -2.9%     +0.0%
        knights          -0.2%     +0.0%      0.00      0.01
           lcss          -0.2%     +0.0%     -3.8%     +0.7%
           life          +0.0%     +0.0%      0.19     -2.9%
           lift          +0.0%     +0.0%      0.00      0.01
      listcompr          -0.2%     +0.0%      0.10      0.13
       listcopy          -0.2%     +0.0%      0.10      0.14
       maillist          -0.2%     +0.0%      0.08     +0.2%
         mandel          -0.2%     -0.0%      0.07      0.09
        mandel2          +0.0%     -0.3%      0.01      0.02
        minimax          -0.2%     +0.0%      0.00      0.01
        mkhprog          +0.0%     +0.0%      0.00      0.01
     multiplier          -0.2%     +0.0%      0.09      0.11
       nucleic2          +0.0%     +0.0%      0.06      0.07
           para          +0.0%     +0.0%     -3.8%     -3.2%
      paraffins          -0.2%     +0.0%      0.08      0.11
         parser          +0.0%     +0.0%      0.03      0.04
        parstof          -0.2%     +0.0%      0.00      0.01
            pic          -0.2%     -2.8%      0.00      0.02
          power          +0.0%     +0.0%     +0.6%     +0.3%
         pretty          +0.0%     +0.0%      0.00      0.01
         primes          -0.2%     +0.0%      0.05      0.06
      primetest          -0.2%     +0.0%     +0.0%     +1.9%
         prolog          -0.2%     +0.0%      0.00      0.01
         puzzle          -0.2%     +0.0%      0.15      0.16
         queens          -0.2%     +0.0%      0.02      0.03
        reptile          -0.2%     +0.0%      0.01      0.03
        rewrite          -0.2%     +0.0%      0.01      0.02
           rfib          -0.2%     +0.0%      0.05      0.06
            rsa          -0.2%     +0.0%      0.07      0.08
            scc          -0.2%     +0.0%      0.00      0.01
          sched          -0.2%     +0.0%      0.02      0.03
            scs          +0.0%     +0.0%     -1.7%     +1.2%
         simple          -0.2%     +0.0%     +0.0%     +2.8%
          solid          -0.2%     +0.0%      0.11      0.13
        sorting          +0.0%     +0.0%      0.00      0.01
         sphere          -0.2%     +0.0%      0.08      0.10
         symalg          -0.2%     +0.0%      0.03      0.04
            tak          -0.2%     +0.0%      0.01      0.02
      transform          -0.2%     -0.5%     -0.7%     -2.8%
       treejoin          +0.0%     +0.0%      0.20     -0.8%
      typecheck          +0.0%     +0.0%      0.19      0.20
        veritas          -0.1%     +0.0%      0.00      0.01
           wang          +0.0%     +0.0%      0.08      0.10
      wave4main          +0.0%     +0.0%     +0.0%     -1.3%
   wheel-sieve1          -0.2%     +0.0%     -4.2%     -4.0%
   wheel-sieve2          -0.2%     +0.0%      0.13      0.16
           x2n1          +0.0%     +0.0%      0.02      0.03
--------------------------------------------------------------------------------
            Min          -0.4%     -4.9%     -4.2%     -4.0%
            Max          +0.0%     +0.0%     +4.6%     +3.2%
 Geometric Mean          -0.1%     -0.1%     -0.9%     -0.2%




More information about the Cvs-ghc mailing list