Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
7431-Optimise-ETS-usage-in-code_server.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 7431-Optimise-ETS-usage-in-code_server.patch of Package erlang
From e85a92c3c51b4674090a1fb1610897077c0322ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Muska=C5=82a?= <micmus@fb.com> Date: Thu, 25 Jan 2024 13:44:04 +0000 Subject: [PATCH] Optimise ETS usage in code_server Since the code_server state already holds a reference to the code_server table that is meticulously passed around, we can look up the direct reference with `ets:whereis`, rather than passing the name around. ETS operations with a refrence are faster than with the name. Additionally, for the `code_names` table, we can make it private and unnamed completely, since it's only used directly from the server, there's no access to it from outside the process. --- lib/kernel/src/code_server.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl index 3a6999f316..b6af3fd282 100644 --- a/lib/kernel/src/code_server.erl +++ b/lib/kernel/src/code_server.erl @@ -78,7 +78,7 @@ init(Ref, Parent, [Root,Mode]) -> register(?MODULE, self()), process_flag(trap_exit, true), - Db = ets:new(?moddb, [named_table, protected]), + Db = ets:whereis(ets:new(?moddb, [named_table, protected])), foreach(fun (M) -> %% Pre-loaded modules are always sticky. ets:insert(Db, [{M,preloaded},{{sticky,M},true}]) @@ -802,7 +802,7 @@ normalize(Other) -> %% The priv_dir/1 and lib_dir/1 functions will have %% an O(1) lookup. create_namedb(Path, Root) -> - Db = ets:new(code_names,[named_table, public]), + Db = ets:new(code_names,[]), init_namedb(lists:reverse(Path), Db), case lookup_name("erts", Db) of -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor