This typesafe.com chart shows the results of the efforts to make the Scala compiler faster over the last several years.
A friend sent me this link about computer latency.
I was reading this post by Martin Odersky (Make the Scala runtime independent of the standard library) and came across this comment by Li Haoyi: “This would also make it more feasible to use Scala for tiny bootstrap scripts; current Mill’s launcher is written in Java because the added classloading needed to use scala.Predef (even just
println) easily adds a 200-400ms of initialization overhead.” I haven’t written anything where the startup time of a Scala application was a huge problem, but that was interesting to read.
(Though I should say that I wish all Scala/Java command-line apps started faster. It’s one reason I occasionally think about using Haskell for small scripts, so I can compile them to an executable.)
I haven’t read the article I’ve linked to yet, I’m just saving it here for future reading.
Back in my day, aerospace engineering undergrad students had very little time to work in the wind tunnels at Texas A&M, but in the limited time I had I tried to look at what makes a knuckleball move erratically. Barton Smith at Utah State University did the same thing (presumably with much more wind tunnel time) looking at a baseball’s spin rate, spin axis, and orientation of the ball.
scala-lang.org has an article titled Speeding Up Compilation Time with `scalac-profiling` where they demonstrate how they reduced a project’s compilation time from 32.5 seconds down to 4 seconds. In addition to all of the scalac and profiling details, it demonstrates a nice use of flamegraphs.
I haven’t tried it yet, but as a note to self, Scala 2.12.5 introduced a new
-Ybackend-parallelism N compiler flag with which “the backend can now run in parallel on N threads.”
“Every person in your company is a vector. Your progress is determined by the sum of all vectors.”
That’s a quote from Elon Musk. In this context a vector is what I know about from my engineering background, a company of both a speed and a direction, something like this:
case class Vector(speed: Double, direction: String)
The correct thing about that quote is that the worst employees I ever had pulled in a direction that was somewhere around 180 degrees opposite of the direction we were aiming for. For example, if nine out of ten employees are rowing a boat that’s headed east, an employee that’s rowing towards the west is going to slow everyone else down.
Unfortunately I never had much success turning those people around, so they were always fired or encouraged to find other work. Over the years we had everything from people whose work had to be completely re-done to people who had agendas during the 8-5 work hours that had nothing to do with the company’s agenda.
The book, Advanced Scala with Cats, has a nice little function you can use to run a block of code “slowly”:
def slowly[A](body: => A) = try body finally Thread.sleep(100)
I’d never seen a try/finally block written like that (without a
catch clause), so it was something new for the brain.
In the book they run a
factorial method slowly, like this:
slowly(factorial(n - 1).map(_ * n))
FWIW, you can modify
slowly to pass in the length of time to sleep, like this:
def slowly[A](body: => A, sleepTime: Long) = try body finally Thread.sleep(sleepTime)
Another good tweet from Brian Greene: “Special Relativity tells us that nothing can travel through space faster than the speed of light, but this does not constrain the speed at which space itself expands. Galaxies can — and do — move apart at faster than light speed.”