On Friday, 15 January 2021 at 15:48:07 UTC, welkam wrote:
On Friday, 15 January 2021 at 14:35:55 UTC, Ola Fosheim Grøstad
wrote:
improved with precise collection
Precise GC is slower than default GC.
D does not have a fully precise GC. The "precise" collector still
scans things conservatively when it cannot be certain.
If you combine fully precise collection it with static analysis,
then you can reduce the number of paths you follow, but it is a
lot of work to implement. So it would take a very motivated
individual.
-lowmem flag replaces all* allocations with GC allocations so
you can benchmark that
Interesting idea. There are compilers that use GC written in
other languages. It is a nice baseline test, especially since
there are not many large commonly known programs for D to do
realistic benchmarks with.
A write barrier is a peace of code that is inserted before a
write to an [object].
Not a write to the object, but a modified pointer. The write
barrier is invoked when you switch a pointer from one object to
another one. Then you mark the object, so you need 2 free bits in
each object to use for marking.
But my uncertainty was related to how to optimize away barrier
that has no impact on the final collection. It is easy to make
mistakes when doing such optimizations. The goal should be to
invoke as few barriers as possible by static analysis.
Reference counting needs mutation. How do you define immutable
RC slice that needs to mutate its reference count? Thats a
unsolved problem in D.
D needs more fine grained immutable, for sure.