[erlang-bugs] Expensive module miss when code path cache is enabled
Tue Nov 19 12:49:38 CET 2013
Hello OTP team,
I was experimenting with Erlang's code path cache and I have found that
some operations actually become quite slower when the code path cache is
In particular, code:ensure_loaded/1 becomes an order of magnitude slower
when the module is not loaded and does not exist in any code path.
By inspecting the code_server source code, I have noticed that this line is
responsible for the slow down:
Basically, every time we can't find a module, the whole code path is
rehashed. The slow down will be even bigger for larger code paths.
I tried blaming the line above with no success. Removing the line also does
not introduce failures into the code_SUITE so I am unsure if this behaviour
is by design or not. The only use case I can think for this behaviour is to
be able to load beam files that are added to code paths *after* the code
path was added to the code server but it seems an arguable behaviour
considering its effects on a module miss.
I may be missing something obvious that justifies the current behaviour
and, if so, I believe we should at least document it. I will be glad to
send a patch if the OTP team agrees with it.
Founder and Lead Developer
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-bugs