top | item 35492860

(no title)

cidd | 2 years ago

Rust has left the building

discuss

order

ufo|2 years ago

The book also has a chapter on reference counting ;-)

rwmj|2 years ago

Rust also uses reference counting, probably the worst sort of garbage collection.

nu11ptr|2 years ago

Only when used in a naïve way, which Rust does not. For example, the increments/decrements are done only when "clone" is called and scope exit respectively, and based on Rust ownership/borrow checking, is rarely done combining the best of both worlds (but yes, implementations with aggressive increment/decrements in loops and on every function call can be very slow). Rust also separates Arc (atomic refs) and Rc (non-atomic refs) and enforces usage scenarios in the type checker giving you cheap Rc in single threaded scenarios. Reference counting when done in a smart way works pretty well, but you obviously have to be a little careful of cycles (which in my experience are pretty rare and fairly obvious when you have such a data type).

sirwhinesalot|2 years ago

The increment/decrement calls only occur on an explicit call to .clone(). No .clone(), no increment/decrement.

You won't see many clones in rust code.

mr_00ff00|2 years ago

Tracing is the worst in terms of performance