summaryrefslogtreecommitdiff
path: root/rts/sm/Storage.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-09-21 13:18:49 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-09-21 13:46:47 +0100
commit016fd74d6517512b62b36ff12cdccf2e723a0fb3 (patch)
treef5be8ca85dc2651ca63932b064f04baf9b7fe01f /rts/sm/Storage.c
parent1f5d83648dfda39d999eb8a9e8192339b3eea540 (diff)
downloadhaskell-016fd74d6517512b62b36ff12cdccf2e723a0fb3.tar.gz
Cache the result of countOccupied(gen->large_objects) as gen->n_large_words (#7257)
The program in #7257 was spending 90% of its time counting the live data in gen->large_objects. We already avoid doing this for small objects, but in this example the old generation was full of large objects (actually pinned ByteStrings).
Diffstat (limited to 'rts/sm/Storage.c')
-rw-r--r--rts/sm/Storage.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 755c65427c..dd2ee31088 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -78,6 +78,7 @@ initGeneration (generation *gen, int g)
gen->n_old_blocks = 0;
gen->large_objects = NULL;
gen->n_large_blocks = 0;
+ gen->n_large_words = 0;
gen->n_new_large_words = 0;
gen->scavenged_large_objects = NULL;
gen->n_scavenged_large_blocks = 0;
@@ -951,7 +952,7 @@ W_ countOccupied (bdescr *bd)
W_ genLiveWords (generation *gen)
{
- return gen->n_words + countOccupied(gen->large_objects);
+ return gen->n_words + gen->n_large_words;
}
W_ genLiveBlocks (generation *gen)