News for hackers. Stuff that matters.
Re:Crystal: Fast as C, Slick as Ruby by dikaiosune on Thursday August 04, 2016 @12:18PM (#12226563)
> wasting precious machine cycles on something that may not be even necessary at all.

I'm not familiar with very many scenarios where one has a garbage collector but doesn't need to free some piece of memory when it's no longer used. Could you clarify what you mean here?

Re:Crystal: Fast as C, Slick as Ruby by bjourne on Thursday August 04, 2016 @01:20PM (#12227064)
For most GC algorithms (but not ref-counting), the time complexity is O(N) where N is the number of surviving objects (or it could be the number of surviving edges/references, I forgot!). For manual/deterministic/eager memory management, the complexity is O(N) where N is the number of allocated/freed objects.

So if the number of survivors << the number of allocated objects, which it always is in many functional languages, then GC can be faster than manual memory management. Especially if you use a copying GC algorithm which makes allocation extremely cheap.

Re:Crystal: Fast as C, Slick as Ruby by Koshkin on Thursday August 04, 2016 @02:39PM (#12227570)
This is true for those compute job types which are mostly 'CPU bound' and which usually create most of the objects that they need at the very beginning; these objects would not be released until the job is finished anyway. I admit that in this case it may take some thought and deliberate effort on the programmer's part to avoid creating many short-lived objects.