Hello community,

here is the log from the commit of package ghc-scientific for openSUSE:Factory 
checked in at 2015-12-01 09:19:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-scientific (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-scientific.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-scientific"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-scientific/ghc-scientific.changes    
2015-10-14 16:45:22.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-scientific.new/ghc-scientific.changes       
2015-12-01 09:19:35.000000000 +0100
@@ -1,0 +2,7 @@
+Sun Nov 29 17:39:11 UTC 2015 - mimi...@gmail.com
+
+- update to 0.3.4.4
+* Fix build with integer-simple.
+* Improved performance of toDecimalDigits by 13%.
+
+-------------------------------------------------------------------

Old:
----
  scientific-0.3.4.2.tar.gz

New:
----
  scientific-0.3.4.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-scientific.spec ++++++
--- /var/tmp/diff_new_pack.yWQhD1/_old  2015-12-01 09:19:36.000000000 +0100
+++ /var/tmp/diff_new_pack.yWQhD1/_new  2015-12-01 09:19:36.000000000 +0100
@@ -19,7 +19,7 @@
 %global pkg_name scientific
 
 Name:           ghc-scientific
-Version:        0.3.4.2
+Version:        0.3.4.4
 Release:        0
 Summary:        Numbers represented using scientific notation
 License:        BSD-3-Clause

++++++ scientific-0.3.4.2.tar.gz -> scientific-0.3.4.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scientific-0.3.4.2/bench/bench.hs 
new/scientific-0.3.4.4/bench/bench.hs
--- old/scientific-0.3.4.2/bench/bench.hs       2015-10-10 10:42:48.000000000 
+0200
+++ new/scientific-0.3.4.4/bench/bench.hs       2015-11-24 02:04:05.000000000 
+0100
@@ -36,6 +36,10 @@
          [ bench "round"        (nf (round :: Scientific -> Integer) $! pos)
          , bench "roundDefault" (nf roundDefault                     $! pos)
          ]
+
+       , bgroup "toDecimalDigits"
+         [ bench "big" (nf toDecimalDigits $! big)
+         ]
        ]
     where
       pos :: Fractional a => a
@@ -50,6 +54,9 @@
       negInt :: Fractional a => a
       negInt = -int
 
+      big :: Scientific
+      big = read $ "0." ++ concat (replicate 20 "0123456789")
+
 realToFracStoD :: Scientific -> Double
 realToFracStoD = fromRational . toRational
 {-# INLINE realToFracStoD #-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scientific-0.3.4.2/changelog 
new/scientific-0.3.4.4/changelog
--- old/scientific-0.3.4.2/changelog    2015-10-10 10:42:48.000000000 +0200
+++ new/scientific-0.3.4.4/changelog    2015-11-24 02:04:05.000000000 +0100
@@ -1,3 +1,9 @@
+0.3.4.4
+       * Improved performance of toDecimalDigits by 13%.
+
+0.3.4.3
+       * Fix build with integer-simple.
+
 0.3.4.2
        * Fix build on GHC-7.4.
          Courtesy of Adam Bergmark..
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scientific-0.3.4.2/scientific.cabal 
new/scientific-0.3.4.4/scientific.cabal
--- old/scientific-0.3.4.2/scientific.cabal     2015-10-10 10:42:48.000000000 
+0200
+++ new/scientific-0.3.4.4/scientific.cabal     2015-11-24 02:04:05.000000000 
+0100
@@ -1,5 +1,5 @@
 name:                scientific
-version:             0.3.4.2
+version:             0.3.4.4
 synopsis:            Numbers represented using scientific notation
 description:
   @Data.Scientific@ provides the number type 'Scientific'. Scientific numbers 
are
@@ -64,6 +64,7 @@
                        Data.Text.Lazy.Builder.Scientific
   other-modules:       Math.NumberTheory.Logarithms
                        GHC.Integer.Logarithms.Compat
+                       GHC.Integer.Compat
                        Utils
   other-extensions:    DeriveDataTypeable, BangPatterns
   ghc-options:         -Wall
@@ -114,20 +115,10 @@
 
 benchmark bench-scientific
   type:             exitcode-stdio-1.0
-  hs-source-dirs:   bench src
+  hs-source-dirs:   bench
   main-is:          bench.hs
   default-language: Haskell2010
   ghc-options:      -O2
-  build-depends:    base        >= 4.3   && < 4.9
+  build-depends:    scientific
+                  , base        >= 4.3   && < 4.9
                   , criterion   >= 0.5   && < 1.2
-                  , ghc-prim
-                  , deepseq     >= 1.3   && < 1.5
-                  , text        >= 0.8   && < 1.3
-                  , bytestring  >= 0.10  && < 0.11
-                  , hashable    >= 1.1.2 && < 1.3
-                  , vector      >= 0.5   && < 0.12
-
-  if flag(integer-simple)
-      build-depends: integer-simple
-  else
-      build-depends: integer-gmp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scientific-0.3.4.2/src/Data/Scientific.hs 
new/scientific-0.3.4.4/src/Data/Scientific.hs
--- old/scientific-0.3.4.2/src/Data/Scientific.hs       2015-10-10 
10:42:48.000000000 +0200
+++ new/scientific-0.3.4.4/src/Data/Scientific.hs       2015-11-24 
02:04:05.000000000 +0100
@@ -92,7 +92,7 @@
 import           Control.Exception            (throw, 
ArithException(DivideByZero))
 import           Control.Monad                (mplus)
 import           Control.Monad.ST             (runST)
-import           Control.DeepSeq              (NFData(rnf))
+import           Control.DeepSeq              (NFData, rnf)
 import           Data.Binary                  (Binary, get, put)
 import           Data.Char                    (intToDigit, ord)
 import           Data.Data                    (Data)
@@ -123,16 +123,10 @@
 import           Data.Bits                    (shiftR)
 #endif
 
-import GHC.Integer (quotRemInteger, quotInteger)
+import GHC.Integer        (quotRemInteger, quotInteger)
+import GHC.Integer.Compat (divInteger)
+import Utils              (roundTo)
 
-import Utils (roundTo)
-
-#if MIN_VERSION_integer_gmp(0,5,1)
-import GHC.Integer (divInteger)
-#else
-divInteger :: Integer -> Integer -> Integer
-divInteger = div
-#endif
 
 ----------------------------------------------------------------------
 -- Type
@@ -953,19 +947,14 @@
 toDecimalDigits (Scientific 0  _)  = ([0], 1)
 toDecimalDigits (Scientific c' e') =
     case normalizePositive c' e' of
-      (c, e) -> case reverseAndLength $ digits c of
-                  (is, n) -> (is, n + e)
-  where
-    digits :: Integer -> [Int]
-    digits 0 = []
-    digits i = case i `quotRemInteger` 10 of
-                 (# q, r #) -> fromIntegral r : digits q
-
-    reverseAndLength :: [a] -> ([a], Int)
-    reverseAndLength l = rev l [] 0
-      where
-        rev []     a !m = (a, m)
-        rev (x:xs) a !m = rev xs (x:a) (m+1)
+      Scientific c e -> go c 0 []
+        where
+          go :: Integer -> Int -> [Int] -> ([Int], Int)
+          go 0 !n ds = (ds, ne) where !ne = n + e
+          go i !n ds = case i `quotRemInteger` 10 of
+                         (# q, r #) -> go q (n+1) (d:ds)
+                           where
+                             !d = fromIntegral r
 
 
 ----------------------------------------------------------------------
@@ -979,12 +968,12 @@
 -- automatically normalized when pretty-printed and in 'toDecimalDigits'.
 normalize :: Scientific -> Scientific
 normalize (Scientific c e)
-    | c > 0 = case normalizePositive   c  e of (c', e') -> Scientific   c'  e'
-    | c < 0 = case normalizePositive (-c) e of (c', e') -> Scientific (-c') e'
+    | c > 0 =   normalizePositive   c  e
+    | c < 0 = -(normalizePositive (-c) e)
     | otherwise {- c == 0 -} = Scientific 0 0
 
-normalizePositive :: Integer -> Int -> (Integer, Int)
-normalizePositive c !e = case quotRemInteger c 10 of
-                           (# c', r #)
-                               | r == 0    -> normalizePositive c' (e+1)
-                               | otherwise -> (c, e)
+normalizePositive :: Integer -> Int -> Scientific
+normalizePositive !c !e = case quotRemInteger c 10 of
+                            (# c', r #)
+                                | r == 0    -> normalizePositive c' (e+1)
+                                | otherwise -> Scientific c e
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/scientific-0.3.4.2/src/GHC/Integer/Compat.hs 
new/scientific-0.3.4.4/src/GHC/Integer/Compat.hs
--- old/scientific-0.3.4.2/src/GHC/Integer/Compat.hs    1970-01-01 
01:00:00.000000000 +0100
+++ new/scientific-0.3.4.4/src/GHC/Integer/Compat.hs    2015-11-24 
02:04:05.000000000 +0100
@@ -0,0 +1,23 @@
+{-# LANGUAGE CPP #-}
+
+module GHC.Integer.Compat (divInteger) where
+
+#ifdef MIN_VERSION_integer_simple
+
+#if MIN_VERSION_integer_simple(0,1,1)
+import GHC.Integer (divInteger)
+#else
+divInteger :: Integer -> Integer -> Integer
+divInteger = div
+#endif
+
+#else
+
+#if MIN_VERSION_integer_gmp(0,5,1)
+import GHC.Integer (divInteger)
+#else
+divInteger :: Integer -> Integer -> Integer
+divInteger = div
+#endif
+
+#endif


Reply via email to