3 ms·
I would presume the Erlang version is much smaller than the C version. Nobody argues that Erlang is faster than C, but it might be fast enough for the task at h
by jlouis 17y ago
I would presume the Erlang version is much smaller than the C version. Nobody argues that Erlang is faster than C, but it might be fast enough for the task at hand.
Functional programs tend to be slower than imperative programs. They also tend to be much smaller. And they tend to be easier to understand and work with once the programmer gets the right mindset.
This just shows another area where C is not the only competitor anymore.
- davidw 17y agoSure, all that's true, and are good reasons to reach for Erlang before C when writing something like this. It seems a bit weird to rewrite working code though, and it's unfortunate not to measure it. I would bet on Erlang not being that much slower than C, and like you say, much smaller, nicer, etc... so it would have been interesting to have some data to think about.
- erlanger 17y agoWhen dealing with high concurrency, Erlang will beat C.
- davidw 17y agoWhat is Erlang written in, again? Erlang makes it (a lot) easier to write high concurrency code, if that's how you define 'beat', but it's not "faster".
- erlanger 17y agoYes, you could theoretically struggle to write C code to work like Erlang, but processes are very cheap in Erlang, and distributed, parallel code is extremely easy to write. C performs well, but can be unstable; Yaws performs as well as Nginx. Erlang's greatest advantage is not in its vertical but its horizontal scalability, which does have consequences for performance.
- neilc 17y agoyou could theoretically struggle to write C code to work like Erlang Lots of people write non-blocking network servers in C (epoll, kqueue, etc -- libevent); that does not constitute "struggling to write C code that works like Erlang", but it still delivers a very high-performance end result. C performs well, but can be unstable C is perfectly "stable", it can just be hard to get right.
- davidw 17y agoWhere Erlang is really strong is that you can handle fairly long running processes that won't block other stuff that's happening. Of course you can find ways to do that in C, but it's just easier and way cleaner in Erlang. This works because of Erlang's internal scheduler.