Skip to content

Commit

Permalink
Remove the copying collector in favor of simple mark/sweep
Browse files Browse the repository at this point in the history
The marginal performance gains weren't worth the
memory and complexity costs.

Although I think we could close the performance gap (Lazy Sweep),
agressively optimizing this collector is a dead-end.
This should be a simple and fairly lightweight collector.
An insanely allocation-intensive workload like `binary_trees`,
wouldn't realisticly depend on "zerogc-simple" for collection.
They would either manually allocate from a typed-arena,
or use a optimized generational garbage collector (planned for DuckLogic).

We should avoid bloating the complexity of the "simple" collector
for these sort of insane benchmarks.

The arenas for small objects is a reasonable optimization.
It actually *reduces* memory usage in many cases (like binary trees).
Small objects are common with managed languages.
I figure Rust code would generally use this for selected types in a
complex objects graph, where nodes are fairly small and of consistent types.

On the other hand, we should switch to an explicit stack of grey objects.
Using recursion could risk stack overflow (See 9a9634d68a4933d00).
Although stack overflow is technically "safe", we should definitely
default to avoid it. Tracing a long linked list shouldn't blow up
the collector by default.....
If the user wants the optimization, they can explicitly ask for it.
It's simple to implement and results in signficant gains: 9a9634d

Although I think I'll personally use the simple collector for short tasks,
we should definitely look into returning memory to the OS (somehow).
To be clear this is only a problem when small-object arenas are enabled.

This implicitly closes #4 by deleting the duplicate code
  • Loading branch information
Techcable committed May 26, 2020
1 parent 9a9634d commit 511be53
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 806 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ arrayvec = { version = "^0.4.6", optional = true }
ndarray = { version = "^0.10.12", optional = true }

[workspace]
members = ["libs/simple", "libs/copying"]
members = ["libs/simple"]
10 changes: 0 additions & 10 deletions libs/copying/Cargo.toml

This file was deleted.

85 changes: 0 additions & 85 deletions libs/copying/examples/binary_trees.rs

This file was deleted.

144 changes: 0 additions & 144 deletions libs/copying/src/alloc.rs

This file was deleted.

Loading

0 comments on commit 511be53

Please sign in to comment.