Small poll

Luke Gorrie luke@REDACTED
Fri Dec 12 19:01:19 CET 2003

"Richard A. O'Keefe" <ok@REDACTED> writes:

> There are only three ways I can think of to get an integer calculation
> down to a single instruction:


> (2) Use some really amazing interval analysis as well as type inference.
>     Erlang doesn't give you much to get started with, though.  About the
>     only thing I can think of is that starting with size(_) and counting
>     down towards 0 should be safe.

Related to the "Network benchmark" thread: one place in Erlang that
you get precise integer-size type information is with the bit syntax,
e.g. "<<X:16, Y:16>> = Bin, X + Y" adds two 16-bit fixnums. Is that a
single-instruction case?

It's possible to imagine a heavy duty optimizer generating fast code
for e.g. checksumming an IP packet, doing lots of 16-bit arithmetic on
values coming out of a binary.

No idea if that's practical, but maybe something to drool over in idle
hours ;-)

By the way, at EUC Thomas Lindgren mentioned the bother of taking care
of "bump reductions" in loops, and Tony Rogvall said something to the
effect of "or we could get rid of bump_reductions and do it properly
instead." What would be the "proper" way?


More information about the erlang-questions mailing list