JVM hate

I came across this paper, published by Google, comparing benchmarks in Scala, C++, Java, and Go.  Scala comes out on top (well, under C++) in performance, by a decent margin.  This surprised me a bit, but makes me happy – Scala is a functional language, and I do think functional languages are the (medium) future of software development.  My main beef with Scala is the JVM. There are (in my mind) several problems with the JVM.

Read More

My shocking Erlang discovery

Sending messages to PIDs is really, really slow (comparatively). Consider the following code, containing two tests that do almost the same thing.  I say “almost” because there’s a small bug causing the totals to be off-by-one, but they’re performing the same amount of functional work.  One uses PID message passing to increment a value; the other uses lambda expressions. -module(test).-export([test/2]).-export([one/1, two/1]). test(F, N) ->    A = F(init),    {T,R} = timer:tc( lists,foldl, [ fun( _, Acc) -> F(Acc) end, A, lists:seq(1, N) ]),     F({stop,R}),    io:format(”\n~ps~n”,[T/1000000]).

Read More

Running a code server in erlang

For as old as Erlang is, there’s a distinct lack of documentation about some aspects of it.  I’ve had a hard time finding information about how to run a code server, so I’m going to write down what I’ve learned here. First, there are a couple of things I should note:While you can use the erlang runtime as a hack-as-you-go platform, it’s really better to follow the OTP principles; you get a lot of things for free that you otherwise end up writing yourself.

Read More