Reputation
1,513
Next privilege 2,000 Rep.
Edit questions and answers
Badges
14 15
Newest
 Pundit
Impact
~87k people reached

  • 0 posts edited
  • 1 helpful flag
  • 142 votes cast
Apr
27
awarded  Pundit
Apr
5
comment Why are reference-counting smart pointers so popular?
@Deduplicator: "Don't know how good the rust-compiler optimizes though, probably nowhere near a C++ compiler yet". Actually C++ was slower than both F# and Rust on my benchmark. Rust uses the LLVM which is the back-end of several major C++ compilers so it generates excellent code. Rust is also able to drive LLVM better by design.
Apr
5
comment Why are reference-counting smart pointers so popular?
@Deduplicator: No, I am a complete Rust noob. However, I did ask the community for feedback. reddit.com/r/rust/comments/4dd5yl/rust_vs_f_hashset_benchmark
Apr
4
comment Why are reference-counting smart pointers so popular?
@Deduplicator: I just benchmarked Rust vs F# on a HashSet benchmark and found F# to be faster in all cases. I'll take a second look from the point of view of memory consumption.
Feb
23
comment OCaml criticism: is it still valid?
How does that apply to user-defined algebraic datatype?
Feb
11
comment Why Garbage Collection if smart pointers are there
@user1703394: "Unbounded pauses due to destructors is an unfortunate property of RAII being used for non-memory resources". No, this has nothing whatsoever to do with non-memory resources.
Feb
10
comment Why Garbage Collection if smart pointers are there
@user1703394: "You have no idea". These ad-hominem attacks are pointless. If there is a reason why you think anything you have referred to is even relevant to this discussion please state it specifically. I agree that Rust is cleaner and safer than C++ and provides a new perspective but that has nothing whatsoever to do with this discussion. Unbounded pauses due to destructors avalanching will be just as prevalent in Rust as they are in C++. Move semantics address a completely unrelated problem. Here is the infinite loop in Rust: doc.rust-lang.org/stable/nomicon/destructors.html
Feb
9
comment Why Garbage Collection if smart pointers are there
@user1703394: "the least pervasively used type of smart pointer". You are implying that weak_ptr is more common than shared_ptr.
Feb
9
comment Why Garbage Collection if smart pointers are there
@user1703394: "broader concept of smart pointers". Smart pointers are not a broader concept.
Feb
9
comment How does garbage collection compare to reference counting?
@gnasher729: "Studies prove what they want to prove". The vast majority of GC research over the past 56 years has concluded that tracing is faster than reference counting though a few die hards continue to pursue RC, e.g. in "Down for the count? Getting reference counting back in the ring" users.cecs.anu.edu.au/~steveb/downloads/pdf/rc-ismm-2012.pdf
Feb
9
comment How does garbage collection compare to reference counting?
@Snowman: "modern languages...Java...C++" . There's something so very wrong with that. :-)
Feb
9
comment How does garbage collection compare to reference counting?
@ALXGTV: "requires a large memory space". This has now been tested and disproven by the "iOS Memory Performance" section of the following benchmark where Swift uses 4x more memory than either Java (RoboVM) or C# (Xamarin). medium.com/@harrycheung/…
Feb
9
comment Why Garbage Collection if smart pointers are there
@user1703394: "this answer should be moved to a question on reference counting. I'ts a poor reference counting answer to a good smart pointer question". You seem to be having a purely emotional response to these facts.
Feb
9
comment Why Garbage Collection if smart pointers are there
@user1703394: "ignore actual usage patterns of the different types of smart pointers". I have observed these phenomena many times on real C++ code bases over the past 20 years. You don't even need to use shared_ptr to see unbounded pauses due to destructors avalanching.
Jan
29
comment Demonstration of garbage collection being faster than manual memory management
Yes, absolutely. No additional effort to write but writing code isn't the bottleneck with C++. Maintaining code is. Maintaining code with this kind of incidental complexity is a nightmare. Most industrial code bases are millions of lines of code. You just don't want to have to deal with that. I've seen people convert everything to shared_ptr just to fix concurrency bugs. The code is a lot slower but, hey, now it works.
Jan
28
comment Demonstration of garbage collection being faster than manual memory management
@Mehrdad:"Have you eliminated such potential sources of error?". Yes. OCaml has a very simple compilation model with no optimisations such as escape analysis. OCaml's representation of the closure is actually substantially slower than the C++ solution so it should really use a custom List.filter as the C++ does. But, yes, you are certainly quite right that some RC operations can be elided. However, the biggest problem I see in the wild is that people don't have the time to perform such optimisations by hand on large industrial code bases.
Jan
28
awarded  Announcer
Jan
27
comment Demonstration of garbage collection being faster than manual memory management
Sure. Install OCaml with the native code ocamlopt compiler under Linux or Mac OS X. Compile the program with ocamlopt nqueens.ml -o nqueens and run it with ./nqueens 11 to get the result for n=11.
Jan
27
comment Why are reference-counting smart pointers so popular?
@Deduplicator: "with and without GC". You meant with tracing GC and with reference counting, right?
Jan
27
comment Why are reference-counting smart pointers so popular?
@Deduplicator: I can envisage programs that give either outcome. Reference counting would outperform tracing GC when the program is designed to keep heap allocate memory until it survives the nursery (e.g. a queue of lists) because that is pathological performance for a generational GC and would generate the most floating garbage. Tracing garbage collection would require less memory than scope-based reference counting when there are many small objects and lifetimes are short but not statically well known so something like a logic program using purely functional data structures.