News for hackers. Stuff that matters.
Re:Crystal: Fast as C, Slick as Ruby by fauigerzigerk on Thursday August 04, 2016 @04:00AM (#12224116)
Crystal seems to be targeted at a domain where ruby is not fast enough. That includes domains where GC is a problem.

A tracing GC means that you either have to deal with potentially long GC pauses or you need a lot of extra free memory at all times to give the GC time to catch up before running out of memory [1].

Go says it can achieve 10ms max pause time using 20% of your CPU cores provided you give it 100% extra memory. In other words, memory utilisation must be kept below 50%.

Cloud/VPS prices scale roughly linearily with memory usage. So using a tracing GC doubles your hardeware costs. Whether or not that is cheap depends entirely on what share of your costs is hardware cost and how much productivity gain you expect from using a tracing GC.

I would be very interested in learning how much CPU and memory overhead Swift's reference counting has, because in terms of productivity Swift is certainly competitive compared to languages using a tracing GC.

[1] Azul can do pauseless, but I don't know exactly what tradeoffs their approach makes. Their price is too high for me to even care.

Re:Crystal: Fast as C, Slick as Ruby by yxhuvud on Thursday August 04, 2016 @05:06AM (#12224332)
Note though that a lot of the problems with GC in crystal can be worked around by replacing classes with structs. The latter are passed by value and allocated on the stack. There is also access to pointers and manual allocation if that should be needed (though that will end up with roughly the same lack of memory safety as in C) to optimize a hotspot.
Re:Crystal: Fast as C, Slick as Ruby by jerven on Thursday August 04, 2016 @05:53AM (#12224475)
For the JVM Shenandoah GC [1] can do so as well (or at least very low consistent pauses) and is available via EA builds or the OpenJDK in fedora 24 [2].

This is with pointer happy java code, not with special effort to have pointer less data.

[1] http://openjdk.java.net/jeps/189 [2] https://fedoraproject.org/wiki/Changes/Shenandoah

Re:Crystal: Fast as C, Slick as Ruby by quotemstr on Thursday August 04, 2016 @12:15PM (#12226537)
> The key to performing concurrent evacuation is having the Java Threads and the GC threads agree on the location of objects. This is accomplished in Shenandoah by the use of a Brooks forwarding pointer. All reads by the Java Threads indirect through this forwarding pointer. All writes to objects in targeted regions must first copy the object and then write to the object in its new location.

I'm a bit surprised that indirection is efficient enough to be worth the trouble (since you need reads and writes to branch for the indirected-object case), but I can't argue with results.

Re:Crystal: Fast as C, Slick as Ruby by mike_hearn on Friday August 05, 2016 @09:00AM (#12231921)
Bear in mind that's a conceptual description. The read/write barriers are implemented as compiler node graphs and thus can be optimised.
Re:Crystal: Fast as C, Slick as Ruby by Taek on Thursday August 04, 2016 @04:08AM (#12224146)
If you are on a server do you need 10ms max pause time? For most applications running go on a remote machine, 25ms should be in the realm of acceptable.
Re:Crystal: Fast as C, Slick as Ruby by sitkack on Thursday August 04, 2016 @04:35AM (#12224245)
Re:Crystal: Fast as C, Slick as Ruby by fauigerzigerk on Thursday August 04, 2016 @04:19AM (#12224190)
True, but I don't know how much that would buy us in terms of memory utilisation and CPU usage.