When running timing tests for the first JVM Concurrency article I was surprised to see the original Scala code taking much longer to execute than the Java code - more than twice as long. I experimented a bit, and found that the performance issue came down to the structure of the loops in the Scala editDistance method...
[Read More]16 Mar · Sun 2014
Scala and scalability
Over the last year and a half I've been increasingly using Scala for my own projects. I really like the Scala approach, which encourages functional programming with immutable values while still allowing you to use imperative programming and/or mutable values (including mutable arrays, which are especially useful) where it's more convenient. That kind of flexibility seems to be part of Scala's genetic makeup. It's not always a blessing - especially when you're new to the language, having 6 different ways of implementing a simple operation can be confusing - but I find it helps more often than it gets in the way.
One of the areas where Scala has really been making a name for itself is concurrent programming. Both the language itself, and many parts of the development ecosystem which has grown up around it, are finding ways to make concurrent programming easier (no surprise, since the name Scala comes from "scalable" + "language"). This is an area that's becoming ever more important for all developers as the number of processing cores in our systems keeps increasing. By way of illustration, as I type this in a cafe I've got >12 processor cores on my person - 4 CPUs each in my laptop, tablet, and cell phone, plus a bunch of GPUs.
In my new IBM developerWorks series I'm going to be covering ways of handling concurrent programming in both Java and Scala. As part of this I'll also be covering the Akka toolkit which supports both Java and Scala concurrent programming. Of course, concurrent programming is only one form of scalability. Scaling out (by distributing work across systems) is just as important as scaling up (by using more processors on a system). The series is going to be focused mostly on the scaling up side, but will also get into scaling out as part of the Akka coverage.
This blog is going to be covering concurrency and scalability topics that may not make it into the series, including some of the behind-the-scenes details of issues or interesting results I run into in the process of writing the articles. Thanks for following along!