-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gc enhancements #261
Comments
part of issue #261 significantly cuts the number of live objects, making GC much faster
GC now 2x faster due to half as many live objects. Another idea:
|
Is it also possible for the compiler to insert calls to free objects that are easily proven as temporary in a code block? That would make it possible for them to be reused in the case of loops (with the allocator being aware), and reduce the load on GC in general. |
That's the idea behind the escape bit tracking. If the object hasn't escaped by the time a function exists, you can free it. |
Here's another idea I plan to implement that also takes advantage of the escape bit. Observation: a lot of garbage was only ever referenced by the stack. Examples include re-assigned local variables, and temporaries that were only function arguments, as in The vast majority of GC time is in traversing the object graph. So we can do a quick "minor collection" by shallow marking (just setting the mark bit on one object and not recurring inside) objects on the stack, then doing a sweep where we free objects neither marked nor escaped. This will free most young garbage in a fraction of the time, giving most of the benefit of generational collection without needing to move objects. |
This sounds great, but I don't understand the core of the technique:
Can you expand on that? |
The idea is to be able to free "obvious garbage" without needing to traverse every live object in the system. Every live object is referenced from either the stack or the heap. The escape bit marks the heap-referenced objects (plus some that may be dead). So if we mark just the stack roots (local variables and arguments), every live object is now either marked or has its escape bit set. Objects with neither are the recently-dead, like the first
|
Ah, I think I see what you're saying now. This relies on the mark-and-sweep having already occurred and having mark bits still set? |
No. The escape bit is set when an object is referenced from the heap, and stays set for the object's whole life. |
What is the current thinking on this one? Implement |
Closed by #8699 |
* adds AsyncCondition that's more compliant with 0.5 version * fixes AsyncCondition on v0.3. also makes tests more deterministic There were a couple `sleep(0.1)` calls in the AsyncCondition tests that I've now swapped out for more explicit Condition-based task switching.
* Added `cor2cov` and `cov2cor` methods. * Switched to accepting `AbstractMatrix` vs `DenseMatrix`. * Added an in-place version of cor2cov and update the docs to mention the in-place versions. * Added in-place specific tests.
Some ideas for making GC faster/better:
The text was updated successfully, but these errors were encountered: