[commit: ghc] master: Use half as much memory when reading interfaces (12e21d3)

git at git.haskell.org git at git.haskell.org
Thu Feb 23 22:27:03 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/12e21d35ee1b77f5f2bb8bd747848f07a32d592f/ghc

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

commit 12e21d35ee1b77f5f2bb8bd747848f07a32d592f
Author: Reid Barton <rwbarton at gmail.com>
Date:   Thu Feb 23 13:54:36 2017 -0500

    Use half as much memory when reading interfaces
    
    I don't see any reason for the (filesize*2), and experimentally
    allocations do go down slightly after this change.
    
    Test Plan: validate
    
    Reviewers: simonmar, austin, bgamari, trofi
    
    Reviewed By: bgamari, trofi
    
    Subscribers: trofi, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3164


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

12e21d35ee1b77f5f2bb8bd747848f07a32d592f
 compiler/utils/Binary.hs               | 2 +-
 testsuite/tests/perf/space_leaks/all.T | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index b10ab1d..a1ccee3 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -207,7 +207,7 @@ readBinMem filename = do
   h <- openBinaryFile filename ReadMode
   filesize' <- hFileSize h
   let filesize = fromIntegral filesize'
-  arr <- mallocForeignPtrBytes (filesize*2)
+  arr <- mallocForeignPtrBytes filesize
   count <- withForeignPtr arr $ \p -> hGetBuf h p filesize
   when (count /= filesize) $
        error ("Binary.readBinMem: only read " ++ show count ++ " bytes")
diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T
index 76ad7a7..a9afd28 100644
--- a/testsuite/tests/perf/space_leaks/all.T
+++ b/testsuite/tests/perf/space_leaks/all.T
@@ -58,14 +58,15 @@ test('T4018',
 
 test('T4029',
      [stats_num_field('peak_megabytes_allocated',
-          [(wordsize(64), 80, 10)]),
+          [(wordsize(64), 76, 10)]),
             # 2016-02-26: 66 (amd64/Linux)           INITIAL
             # 2016-05-23: 82 (amd64/Linux)           Use -G1
             # 2016-07-13: 92 (amd64/Linux)           Changes to tidyType
             # 2016-09-01: 71 (amd64/Linux)           Restore w/w limit (#11565)
             # 2017-02-12: 80 (amd64/Linux)           Type-indexed Typeable
+            # 2017-02-20: 76 (amd64/Linux)           Better reading of iface files
       stats_num_field('max_bytes_used',
-          [(wordsize(64), 24151096, 5)]),
+          [(wordsize(64), 22016200, 5)]),
             # 2016-02-26: 24071720 (amd64/Linux)     INITIAL
             # 2016-04-21: 25542832 (amd64/Linux)
             # 2016-05-23: 25247216 (amd64/Linux)     Use -G1
@@ -77,6 +78,7 @@ test('T4029',
             # 2017-01-18: 21670448 (amd64/Linux)     Float string literals to toplevel
             # 2017-02-07: 22770352 (amd64/Linux)     It is unclear
             # 2017-02-12: 24151096 (amd64/Linux)     Type-indexed Typeable
+            # 2017-02-20: 22016200 (amd64/Linux)     Better reading of iface files
       extra_hc_opts('+RTS -G1 -RTS' ),
       ],
      ghci_script,



More information about the ghc-commits mailing list