Join GitHub today
GC improvement #3165
Here are my benchmark results, comparing three different workloads between master (OLD) and this PR (NEW). The first workload currently completely trashes the GC implementation on master, the other two are more lightweight.
Here the GC "disabled" lines mean disabled at runtime, so roots are still collected.
// Very, very, very many objects GC | OLD | NEW disabled | 1.32s | 1.50s enabled | 12.75s | 2.32s // Very many objects GC | OLD | NEW disabled | 0.87s | 0.87s enabled | 1.48s | 0.94s // Less many objects GC | OLD | NEW disabled | 1.65s | 1.62s enabled | 1.75s | 1.62s
The most interesting is probably the first result:
- With GC enabled, this is still 1.5x slower than with GC disabled (previously it was nearly 10x slower). This is because the (linear) GC threshold backoff happens too slowly for this case. I think this is fine to start with.
- With GC (runtime) disabled, we have a slowdown from the old to the new implementation (1.32s to 1.50s). perf shows that 10% of the time is spent inside
gc_remove_compressed. So this workload happens to use enough objects that the compression scheme becomes a problem...
For the compression, I wonder if the current scheme that separates compressed & uncompressed addresses is really worthwhile. I would suggest to always mask the address (something like this: https://gist.github.com/nikic/515dc2dfdc4912cee5c6e1fb17a4d276). This means that we always have to do a
root->ref != ref check when removing a root, but on the other hand it saves a bunch of checks in other places and also resolves the
gc_remove_compressed performance issue mentioned above. Looking at perf, always doing this check does not seem problematic.
In any case, I really like this implementation, dropping the linked lists makes this a lot nicer. It's a great improvement, let's land it!
referenced this pull request
Mar 1, 2018
@nikic thank you for review and benchmarks. Really impressive :)
You may play with GC_THRESHOLD adoption after the merge.
I'll think about compression once again.
I hope, I'll merge this by tomorrow evening.