關於 erlang 的一些有趣觀點

這幾天查文件偶然看到一些有趣的反駁文 : Erlang is slow: and other rubbish
反駁的就是很久以前看過的討戰文 : How and Why We Switched from Erlang to Python
雖然之前的確看過這篇文章, 但是沒有細看回文, 也沒有追蹤, 只覺得是屁話.
為什麼說那篇是屁話? 看看 Twisted 向 erlang 學習多少, 就可以知道 erlang 在這方面的優秀.

文內當然拿討戰文的論點來比較, 其中打臉最大的大概就是原文說 erlang 的 json lib 超慢, 然後 python 的快 10 倍至少.
這顯然不客觀, 你拿個 erlang 最慢的 json lib 去比一個用 c 寫給 python 的 json lib.
文內就拿出 erlang 的 jiffy 和用 c 寫的 python lib ujson, 兩者其實相差無幾.
jiffy 是 50% 以上的 erlang + 3x% 的 c++ 寫
ujson 是 63% 的 c 寫 + 3x% 的 python 寫
咦, 我們不是在比較 python 嗎?? 怎麼好像是 erlang 跟 c 比?

以下是數據 :
ujson: 1,160ms
jiffy: 1,271ms
simplejson (with C): 1,561ms
json: 2,378ms
mochijson2: 8,692ms
mochijson: 11,111ms
simplejson (no C): 16,805ms

當然這樣連來連去就連到以前我 po 過的文章 Is Erlang a good language choice for performance critical systems when compared to Scala and Go?

我覺得最讓我 欣賞 & 欣慰的就是下面這一段話了 :

The thing is – Erlang is a concurrent programming language, so it’s optimized for concurrency and the problems therein. HiPE optimizes the sequential part of the system, but cannot do anything about schedulers etc, so it does not affect the concurrency characteristics (which it shouldn’t either). HiPE does a really good job, but for sequential mini-benchmarks, HiPE or no HiPE will never be as fast as C++. We do not optimize for that either. Comparing HiPE to i.e. GCH, OCaml or any other common native compiler is really unfair. The other compilers make binaries directly on top of the OS, with no support for massive concurrency in any VM. Not to say that aren’t really good compilers, but they solve a different problem.

Building large systems with Erlang will show the whole picture, not running micro benchmarks. If your business is to sell game-of-life, rannkuch-redux or mandelbrot programs, you will get severely disappointed if trying to make the fastest program in Erlang. If you on the other hand is writing a large server, you will be surprised about what level of concurrency, what uptime and what hardware utilization you will achieve.

So – we are really working on optimization, but not on optimizing benchmarks, but on making it possible to implement highly available, scalable, parallell and concurrent systems.

大意就是, 老兄, 你不要拿香蕉比柳丁, 蘋果比芭樂. Erlang 在 concurrency 仍然是無人能及的.
這是另一篇的 Go 與 Erlang : Some Thoughts on Go and Erlang
也很中肯, 不過可以看到上面有置頂的 UPDATE, 看來哪個國家都有這樣的人啊.
人家明明講得很中肯, 硬要拆解文字來曲解整篇文章的意思.