[erlang-bugs] Expensive module miss when code path cache is enabled
Tue Nov 19 13:08:16 CET 2013
I guess the blame is mine, and I agree that "feature" is questionable.
The idea was that the cache should behave as the non-cached variant
as much as possible. And in the non-cached variant the whole code path is
searched and the cache could be updated as well.
Since the patch is trivial, can you add it and we will bring up to
and here if someone has an opinion.
On Tue, Nov 19, 2013 at 12:49 PM, José Valim <
> 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.
> *José Valim*
> Skype: jv.ptec
> Founder and Lead Developer
> erlang-bugs mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-bugs