Which is faster?

Shawn Pearce spearce@REDACTED
Wed Mar 12 22:30:38 CET 2003


So the "Efficiency Guide" leads me to believe that sticking a function in ets would
be faster than using Module:Function(Arg) to invoke a function.  ie:

	[#rec{function=Fun}] = ets:lookup(some_table, Key),
	Fun(X)

is faster than:

	[#rec{module=Module, function=Function}] = ets:lookup(some_table, Key),
	Module:Function(X)

Clearly either way we are doing an ets call, but I ask in the context of two
things:

	- What is the cost of copying the fun from ets to the local process?

	- What happens when I reload the module that created Fun?  Clearly
	  in the second case hot-reloading works well.

-- 
Shawn.

  Just to have it is enough.



More information about the erlang-questions mailing list