Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> "When using a GC you can get 1:1 performance to non-GC if you preallocate."

That is not always true. Also, preallocation can be impossible (due to limit on heap size) if there is no way to free memory without the GC running. Of course, you're right that there are tradeoffs, the only argument here is about the magnitude of the tradeoffs - the OP shows a hidden cost of GC that is not talked about often enough.



What are the cases where the is untrue? Are they mainstream or niche? It would be a shame to caution people away from GC by default because there exist niche cases where GC performance doesn't match manual management.


It's not always possible to get cache coeherancy with a ref based language which can be 10-50x difference in performance.


Refs might be but they aren't inherent to GC, you can have Refs without GC.

I would love to see a benchmark of GC vs non-GC using the same compiler and language for an accurate comparison. Probably also GC vs non-GC naive vs non-GC optimized.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: