Erlang questions on comp.lang.functional.

Bjorn Gustavsson <>
Mon Mar 3 11:48:42 CET 2003

Shawn Pearce <> writes:
> >  2. Bytecode interpreted (i.e. not compiled to native code).

Beam is not byte code interpreted.

The byte code in the beam files is converted to threaded code by the loader.
The threaded code consists of a pointer to directly executable code, followed
by the operands.

The loader also specializes instructions (e.g. the 'move' instruction will
be replaced with one of about a dozen specialized 'move' instructions) and
does other optimizations such merging of common instructions sequences.

> Isn't this why we have HIPE?  And thus far, I have not seen HIPE improve
> performance over code run in the bytecode interpreter.  Therefore I have
> to ask:
> 	- is the rest of erts slow?
> 	- is the bytecode interpreter really fast?
> 	- do I just keep my mathmatical computation outside of erlang?

In R8 and R9 floating point operations are specially optimized, as long as
the compiler can figure out that they indeed are floating point operations.
(The best way to inform the compiler is to use the 'is_float/1' guard BIF
for arguments that are known to be floating point numbers.)


Björn Gustavsson            Ericsson Utvecklings AB
			    BOX 1505
+46 8 727 56 87 	    125 25 Älvsjö

More information about the erlang-questions mailing list