Earlier quoted context omitted.
Tracing garbage collectors don’t generally win against reference counting connectors, especially when those reference counts are automatically elided via ARC (eg swift and objective C) or because they’re rarely used by means of composition (c++ and rust). Additionally, different kinds of application strategies are better depending on the use case (eg a pool allocator that you bulk drop at the end of some computation)…
Swift and Objective-C ARC performance is quite poor.
The Garbage Collection Handbook, 2nd Edition
91–100 of 174 posts
Re: The Garbage Collection Handbook, 2nd Edition
#92Will there be a PDF / epub option?
Re: The Garbage Collection Handbook, 2nd Edition
#93Earlier quoted context omitted.
Tracing garbage collectors don’t generally win against reference counting connectors, especially when those reference counts are automatically elided via ARC (eg swift and objective C) or because they’re rarely used by means of composition (c++ and rust). Additionally, different kinds of application strategies are better depending on the use case (eg a pool allocator that you bulk drop at the end of some computation)…
Then why do every performant managed language opts for tracing GCs when they can? RC is used in lower level languages because it doesn’t require runtime support , and can be implemented as a library. As I wrote in another comment, even with elisions, you are still trading off constant writes on the working thread for parallel work, and you even have to pay for synchronization in parallel contexts.
Re: The Garbage Collection Handbook, 2nd Edition
#9420 years ago in the programming languages lesson at the university we started learning about OOP using Java and Ada as examples. When the professor started describing Java, a fellow student interrupted him to inform the class that "Java has garbage collection" (and boast of his special knowledge). After that incident his nickname was "the garbage collector"!
Coincidentally, Ada optionally supports garbage collection in its specifications but it's up to the runtime to implement it.
Re: The Garbage Collection Handbook, 2nd Edition
#9520 years ago in the programming languages lesson at the university we started learning about OOP using Java and Ada as examples. When the professor started describing Java, a fellow student interrupted him to inform the class that "Java has garbage collection" (and boast of his special knowledge). After that incident his nickname was "the garbage collector"!
Coincidentally, Ada optionally supports garbage collection in its specifications but it's up to the runtime to implement it.
Re: The Garbage Collection Handbook, 2nd Edition
#96Re: The Garbage Collection Handbook, 2nd Edition
#97if you need code to understand garbage collection, there is walkthrough of garbage collector and C code at http://maplant.com/gc.html is really helpful. I tweaked it to work on amd64 and started adding register scanning based on what eatonphil's discord people told me to do. https://github.com/samsquire/garbage-collector It's not fit for any purpose but more of a learning exercise.
Bob Nystrom (of Game Programming Patterns , Crafting Interpreters , and dartfmt fame) also wrote a tutorial implementation[1], of a precise tracing GC as opposed to a conservative one. Regarding register scanning in a conservative GC, Andreas Kling has made (or at least quoted) the amusing observation[2] that your C runtime already has a primitive to dump all callee-save registers to memory: setjmp(). So all you have…
Although losing the stack and instruction pointers is unlikely to be a problem for the GC context, the frame pointer register need not contain a frame pointer value. It can be an arbitrary program value depending on compile options. That's something to watch out for with this GC technique.
Re: The Garbage Collection Handbook, 2nd Edition
#98Earlier quoted context omitted.
Then why do every performant managed language opts for tracing GCs when they can? RC is used in lower level languages because it doesn’t require runtime support , and can be implemented as a library. As I wrote in another comment, even with elisions, you are still trading off constant writes on the working thread for parallel work, and you even have to pay for synchronization in parallel contexts.
Because they don’t care as much about working set size as Apple does.
But we were talking about performance here, and especially in throughput, tracing GCs are much better.
Re: The Garbage Collection Handbook, 2nd Edition
#99Earlier quoted context omitted.
I don’t know anything about the benchmark, but how would you test GC implementations without reference types?
Swift’s value types have reference counts because they may have members that need their lifetimes to be managed appropriately. (For example, if they’re reference types.)