Optimize clearNursery by short-circuiting when we get to currentNursery
This is a note to myself so I don't forget about this. Essentially, we can do something like this (this particular patch variant untested):
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 36776b9..0311042 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -598,6 +598,11 @@ clearNursery (Capability *cap)
ASSERT(bd->gen_no == 0);
ASSERT(bd->gen == g0);
IF_DEBUG(sanity,memset(bd->start, 0xaa, BLOCK_SIZE));
+ if (bd == cap->r.rCurrentNursery) {
+ IF_DEBUG(sanity, for (bd = bd->link; bd; bd = bd->link)
+ ASSERT(bd->free == bd->start));
+ break;
+ }
}
}
}
This is due to invariants about how we manage the currentNursery pointer. But we need a note about it, and I need to test it more carefully. This optimization probably doesn't help too much on normal GHC, but when I have lots of nurseries it helps quite a bit.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.9 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Runtime System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | simonmar |
| Operating system | |
| Architecture |