Arranging arguments for speed

Roger Price rprice@REDACTED
Mon Mar 24 01:00:57 CET 2003


Given a function such as

  f(X,alpha) -> ...;
  f(X,bravo) -> ...;
      .....
  f(X,zebra) -> ... .,

would it run faster if re-written as

  g(alpha,X) -> ...;
  g(bravo,X) -> ...;
      .....
  g(zebra,X) -> ... . ?

It was certainly the case for a Prolog system I once used, and I wondered
if Erlang also used a hash of the function name and the first argument to
find the clause.

Roger




More information about the erlang-questions mailing list