summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Barton <rwbarton@gmail.com>2017-02-19 20:05:06 -0500
committerReid Barton <rwbarton@gmail.com>2017-02-20 14:49:41 -0500
commit99894850e71c9fc8f8e5f5531f4a643dbff081c0 (patch)
treedcc247bb9055e6bcca4c18f0b9b560ca8bc0bd5f
parent6ad89d7bacc9aeca377d05e4f74b35f4036f7d25 (diff)
downloadhaskell-wip/rwbarton-D3164.tar.gz
Use half as much memory when reading interfaceswip/rwbarton-D3164
Summary: I don't see any reason for the (filesize*2), and experimentally allocationsn do go down slightly after this change. Test Plan: validate Reviewers: simonmar, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3164
-rw-r--r--compiler/utils/Binary.hs2
-rw-r--r--testsuite/tests/perf/space_leaks/all.T6
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index b10ab1d5f2..a1ccee3ae7 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 76ad7a7606..a9afd285f2 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,