Pattern matching vs. ETS lookups
Vance Shipley
vances@REDACTED
Mon Feb 16 23:35:23 CET 2004
Very good however with this method you have to account
for holes in the list. If the highest values of the
16 bit FunctionID are used you need the whole 65K in
the tuple.
This is pretty much what we used to do in the good old
C days where this problem is solved by an array of
pointers to functions.
-Vance
On Mon, Feb 16, 2004 at 11:23:28PM +0100, Ulf Wiger wrote:
}
} Or simply a tuple of tuples:
}
} f(<<FunID_MSB/8, FunID_LSB/8, Body/binary>>, Matrix) ->
} BodyParsingFunction =
} element(FunID_LSB, element(FunID_MSB, Matrix)),
} BodyParsingFunction(Body).
}
} Hard to beat for speed, I think.
}
} /Uffe
} --
} Ulf Wiger
More information about the erlang-questions
mailing list