Computer Language Shootout - concurrency

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Wed Dec 7 14:42:50 CET 2005


Oh, I should hasten to add that it was conjecture
based on my reading of the code. I did not trace
the benchmark code to see that erts_mixed_plus()
in fact got called.

What I did was compile with the -S flag with and
without is_integer/1 guards, and then run diff on
the output. The only difference was the call to 
the guard, but it didn't affect any of the other
code.

In both cases, the following instruction was:

    {bif,'+',{f,0},[{x,1},{integer,1}],{x,0}}.

where the constant value is obviously tagged as 
and integer.

In erl_bif.tab, the '+' operation seems to map
to splus_2(), which turns around and calls 
erts_mixed_plus(). I have failed to spot the 
optimization that you speak of. That obviously
isn't meant to imply that it isn't there - only
that I was unable to find it.

/Uffe 

> -----Original Message-----
> From: owner-erlang-questions@REDACTED 
> [mailto:owner-erlang-questions@REDACTED] On Behalf Of Bjorn 
> Gustavsson
> Sent: den 7 december 2005 09:17
> To: erlang-questions@REDACTED
> Subject: Re: Computer Language Shootout - concurrency
> 
> "Ulf Wiger (AL/EAB)" <ulf.wiger@REDACTED> writes:
> 
> > I thought that, worst case, it wouldn't make a difference. As it is 
> > now, the compiler inserts the is_integer/1 checks, but 
> doesn't act on 
> > the result. Eventually, the function splus_2 in erl_arith.c ends up 
> > being called, and it turns around and calls 
> erts_mixed_plus(), which 
> > is so complex, I didn't even bother to understand it.
> > It does handle all combinations of smallints, bignums and floats.
> > 
> 
> This is strange.
> 
> Both Beam and hipe-native code have special cases for 
> addition of "small integers" (signed integers that fit into 
> 28 bits), so that erts_mixed_plus() does not get called.
> 
> Are you sure that the benchmark code itself causes the call 
> erts_mixed_plus() (and not, for instance, the benchmarking 
> framework)? Or could it be that the ackermann benchmark uses 
> big numbers or floats?
> 
> /Bjorn
> --
> Björn Gustavsson, Erlang/OTP, Ericsson AB
> 



More information about the erlang-questions mailing list