Scala 2.9 parallel collections for MandelActors

Scala 2.9 is out, and one of the new features in this release are parallel collections. These make it almost trivial to do for example a foreach over a collection in parallel. I added a ParallelCollectionsRenderer to MandelActors which looks very simple: object ParallelCollectionsRenderer extends Renderer { override def render(sampler: Sampler, compute: Sample => Color, …

Continue reading ‘Scala 2.9 parallel collections for MandelActors’ »

Specializing for primitive types

One interesting feature that was added to Scala in version 2.8 is specialization, using the @specialized annotation. First, a little background information. Generics in Java and the JVM, and consequently also in Scala, are implemented by using type erasure. That means that if you have an instance of a generic class, for example List[String], then …

Continue reading ‘Specializing for primitive types’ »