[erlang-questions] Erlang is the best choice for building commercial application servers

Phillip Toland phil.toland@REDACTED
Wed Mar 14 19:44:10 CET 2012


This reminds me of the early days of Ruby on Rails. The Java people
would create micro benchmarks showing Java outperforming Ruby by a
significant margin. The Rails folks would then produce actual sites
that outperformed comparable Java sites by a significant margin. When
most of the time is spent in network IO raw computational performance
is far less of an issue.

The JVM performs very well and Java looks good in simple benchmarks.
Actual Java applications, not so much.

~p

On Wed, Mar 14, 2012 at 8:17 AM, Michael Turner
<michael.eugene.turner@REDACTED> wrote:
> There must be some corollary of Godwin's Law saying that all
> discussions of programming languages, if they go on long enough, must
> eventually degenerate into disagreements over either benchmark results
> or open source licenses. ;-)
>
> -michael turner
>
> On Wed, Mar 14, 2012 at 7:06 PM, Jan Burse <janburse@REDACTED> wrote:
>> Shahrdad Shadab schrieb:
>>>
>>> _Java performance is nowhere near Erlang.
>>
>>
>> Where is the evidence? I don't know
>> whether Joe would approve with this
>> statement?
>>
>> Did a little micro benchmark: Erlang is
>> slower than Java. For general purpose
>> programming. Did not test some message
>> passing or so.
>>
>> Here are some results for Naive Reverse:
>>
>> Erlang 64-bit R15B: ~60 ms
>> Java 64-bit JDK 1.7: ~30 ms (Turbo boost ~15ms)
>>
>> Tested on Windows 7,
>> Sony VAIO VPC-SA3J1E/XI,
>> CPU i5 2430M, 4GB RAM
>>
>> ------------------ benchmark.erl --------------------------
>>
>> -module(benchmark).
>> -export([test/0,nrev/0]).
>>
>> append([],X) -> X;
>> append([X|Y],Z) -> [X|append(Y,Z)].
>>
>> reverse([]) -> [];
>> reverse([X|Y]) -> append(reverse(Y),[X]).
>>
>> data() -> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
>> 21,22,23,24,25,26,27,28,29,30].
>>
>> nrev() -> reverse(data()).
>>
>> for(0,F) -> true;
>> for(N,F) when N>0 -> apply(benchmark,F,[]), for(N-1,F).
>>
>> bench(N,F) ->
>> {_,_,X}=os:timestamp(),
>> for(N,F),
>> {_,_,Y}=os:timestamp(),
>> io:write(F),
>> io:put_chars("\tin "),
>> io:write(Y-X),
>> io:put_chars(" (mics)"),
>> io:nl().
>>
>> test() -> bench(6000,nrev).
>>
>> ---------------------- ConsCell.java ---------------------------
>>
>> package demo.perpetual;
>>
>> /**
>>  */
>> final class ConsCell {
>>    private final Object head;
>>    private final Object tail;
>>
>>    ConsCell(Object h, Object t) {
>>        head = h;
>>        tail = t;
>>    }
>>
>>    Object getHead() {
>>        return head;
>>    }
>>
>>    Object getTail() {
>>        return tail;
>>    }
>>
>> }
>>
>> ---------------------- NaiveReverse.java -----------------------------
>>
>> package demo.perpetual;
>>
>> /**
>>  */
>> public final class NaiveReverse {
>>    private static Object data;
>>
>>    static {
>>        Object help = null;
>>        for (int i = 30; i >= 1; i--) {
>>            help = new ConsCell(Integer.valueOf(i), help);
>>        }
>>        data = help;
>>    }
>>
>>    private static Object append(Object alfa, Object beta) {
>>        if (alfa == null) {
>>            return beta;
>>        } else {
>>            ConsCell help = (ConsCell) alfa;
>>            return new ConsCell(help.getHead(), append(help.getTail(),
>> beta));
>>        }
>>    }
>>
>>    private static Object reverse(Object alfa) {
>>        if (alfa == null) {
>>            return null;
>>        } else {
>>            ConsCell help = (ConsCell) alfa;
>>            return append(reverse(help.getTail()),
>>                    new ConsCell(help.getHead(), null));
>>        }
>>    }
>>
>>    private static void _for(int n) {
>>        for (int i=0; i<n; i++) {
>>            reverse(data);
>>        }
>>    }
>>
>>    private static void bench(int n) {
>>        long t1=System.nanoTime();
>>        _for(n);
>>        long t2=System.nanoTime();
>>        System.out.println("nrev\tin "+(t2-t1)+" (nanos)");
>>    }
>>
>>    public static void main(String[] args) {
>>        bench(6000);
>>        bench(6000);
>>    }
>> }
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



-- 
~p



More information about the erlang-questions mailing list