3 ms·
what the article fails to mention is that BIFs can mess with your timing -- a BIF call costs one reduction, no matter how long it takes. I'd say that this is co
by kaeluka 14y ago
what the article fails to mention is that BIFs can mess with your timing -- a BIF call costs one reduction, no matter how long it takes. I'd say that this is comparable in seriousness as the array-operation example, since BIF calls are probably more common.
edit: none the less, I like erlang, it is a brilliant tool for a small but important class of problems. When comparing erlang to akka recently, I found that erlang, indeed does a quite good job in delivering predictable performance (all on a very limited benchmark), while akka is less reliable in that regard. However, I did construct a very simple network topology that was as similar in both cases as possible, so that excluded features like routers in akka.
Akka's performance on average tends to be better, though (roughly same for pure message passing, the more work you add, the more Akka tends to outrun erlang.)
So, it's, as always, a tradeoff.
edit #2:
I regard erlang's scheduler to be one of the advantages erlang has: allowing all threads to progress at the same time is amazing. If you compare this with task based parallelism, backed by a thread pool of size N: only N threads are able to 'make progress', while in erlang, every process gets a fair share. That's really, really, cool.
- ibotty 14y agothe article mentions bifs. (and i don't think benchmarks are very clear between akka and erlang. erlang is a proven technology though.)
- ot 14y agoFrom the article: [n2] This section is also why one must beware of long-running NIFs. They do not per default preempt, nor do they bump the reduction counter. So they can introduce latency in your system. The OP calls them NIFs, but it is essentially what you are saying.
- grating 14y agoA NIF isn't the same thing as a BIF. NIFs where introduced in R13B03 and are in short, user-code written in C. BIFs on the other hand are built-ins implemented in a completely different manner.
- jlouis 14y agoBIFs are written in a better way than what you think. They all manipulate the reduction counter internally, if they run in complex patterns with loops. This in effect means you avoid the problem where a BIF hogs the CPU.