You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe. application:get_env/1 calls application_controller:get_pid_env/1 which in turn calls ets:match/2 on ac_tab with no bound key:
https://github.com/erlang/otp/blob/master/lib/kernel/src/application_controller.erl#L345 ac_tab can be large enough as it stores all the env vars for all the apps. At the same time, application:get_env/1 may be considered as a high-performance/minimum overhead function and be called frequently, e.g. per each request/operation being processed.
There is no mentioning in the documentation, that this function should be used with care and/or that application:get_env/2,3 is preferable performance-wise (as it's just a single ets lookup).
Describe the solution you'd like
There are seem to be fairly easy fixes to improve efficiency:
store inverted Pid to App index in the same tab, e.g.: {Pid, {application_master, AppName}} and avoid using ets:match/2 at all
store {{application_master, '$1'}, Pid} records in a separate tab, so that the table size can be kept more or less small
Describe alternatives you've considered
at least add a note to Application documentation, warning a user that functions with ommited AppName may have a worse performance.
Additional context
There are more functions in application_controller module implemented in a similar manner: get_pid_key/2, get_pid_all_key/1get_pid_all_env/1
The text was updated successfully, but these errors were encountered:
After the first release candidate, we generally focus on bug fixes and polishing of features already included or planned for the release. To ensure that Erlang/OTP 27 will be as good as it possibly can be, we need to minimize the time we spend on things not to be included in the release. Therefore, we will not investigate/consider this feature request until after OTP 27 has been released. If we have not came back to it before September, feel free to remind us.
Is your feature request related to a problem? Please describe.
application:get_env/1
callsapplication_controller:get_pid_env/1
which in turn callsets:match/2
onac_tab
with no bound key:ac_tab
can be large enough as it stores all the env vars for all the apps. At the same time,application:get_env/1
may be considered as a high-performance/minimum overhead function and be called frequently, e.g. per each request/operation being processed.There is no mentioning in the documentation, that this function should be used with care and/or that
application:get_env/2,3
is preferable performance-wise (as it's just a single ets lookup).Describe the solution you'd like
There are seem to be fairly easy fixes to improve efficiency:
{Pid, {application_master, AppName}}
and avoid usingets:match/2
at all{{application_master, '$1'}, Pid}
records in a separate tab, so that the table size can be kept more or less smallDescribe alternatives you've considered
Application
documentation, warning a user that functions with ommited AppName may have a worse performance.Additional context
There are more functions in
application_controller
module implemented in a similar manner:get_pid_key/2
,get_pid_all_key/1
get_pid_all_env/1
The text was updated successfully, but these errors were encountered: