Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

application:get_env/1 performance improvement #8105

Open
SergeTupchiy opened this issue Feb 9, 2024 · 2 comments
Open

application:get_env/1 performance improvement #8105

SergeTupchiy opened this issue Feb 9, 2024 · 2 comments
Assignees
Labels
enhancement stalled waiting for input by the Erlang/OTP team team:VM Assigned to OTP team VM

Comments

@SergeTupchiy
Copy link

SergeTupchiy commented Feb 9, 2024

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:

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/1 get_pid_all_env/1

@SergeTupchiy
Copy link
Author

If you agree that this worth a fix and have a preferred solution (either from the proposed ones or something new), I'd be happy to send a PR for that.

Thanks in advance!

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Feb 9, 2024
@jhogberg jhogberg added the stalled waiting for input by the Erlang/OTP team label Feb 19, 2024
@bjorng
Copy link
Contributor

bjorng commented Feb 20, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement stalled waiting for input by the Erlang/OTP team team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

4 participants