[erlang-questions] Blog: Erlang Fractal Benchmark

Mats Cronqvist mats.cronqvist@REDACTED
Tue Jun 5 16:01:42 CEST 2007


Ulf Wiger wrote:
> It seems counter-intuitive at first, doesn't it? (:
> Adding checking to the code shouldn't speed things up,
> but the thing is that, being dynamically typed, Erlang will
> have to do type checking in all the multiplications, etc,
> checking first the operands, and then the result.
> 
> But if the compiler can deduce (because of the guards)
> what the type signature is, it can generate much more
> efficient code, foregoing redundant type checks.
> 
> I think(*) it's pretty much generally true that adding type
> guards never slows things down, but adds compile-time
> info that can be used by Dialyzer as well as in some
> optimizations.

   so having better syntax for type guards would be a big win...

   mats



More information about the erlang-questions mailing list