二郎山 - C和二郎 [英] Erlang - C and Erlang

查看:156
本文介绍了二郎山 - C和二郎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有二郎某些共同的库函数比其等价的C慢得多。

There are certain common library functions in erlang that are much slower than their c equivalent.

时有可能有C code执行二进制解析和数字运算,并有二郎神重生进程运行C code?

Is it possible to have c code do the binary parsing and number crunching, and have erlang spawn processes to run the c code?

推荐答案

当然的C会更快,在极端情况下,优化后。如果你越快意味着运行更快。

Of course C would be faster, in the extreme case, after optimizations. If by faster you mean faster to run.

二郎将是迄今为止,快写。根据您有二郎速度要求很可能是不够快,它会保存在C寻找臭虫天。

Erlang would be by far, faster to write. Depending on the speed requirements you have Erlang is probably "fast enough", and it will save you days of searching for bugs in C.

C $ C $按c只有优化后速度更快。如果你花时间在C和二郎相同数量,你会拿出大约相同的速度(注意,我算时间花在调试和错误在这个时间估计固定。这将是二郎少很多)。

C code will only be faster after optimizations. If you spend the same amount of time on C and Erlang you will come out with about the same speed (note that I count time spent debugging and error fixing in this time estimation. Which will be a lot less in Erlang).

所以:

faster writing = Erlang
faster running (after optimisations) = C
faster running without optimisations = any of the two

你们随便挑。

这篇关于二郎山 - C和二郎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆