aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2016-04-27 21:54:57 +0200
committerBjörn Gustavsson <bjorn@erlang.org>2016-04-29 09:58:27 +0200
commit77cad6b3b87e5c073040ec71f42683e8da6847a2 (patch)
treeeddf628f7a6cfec3582a862217a984c107387747 /lib/kernel/src
parent73bc045aa5b432f6ed34475ae7a1d5fa6566a9dd (diff)
downloadotp-77cad6b3b87e5c073040ec71f42683e8da6847a2.tar.gz
otp-77cad6b3b87e5c073040ec71f42683e8da6847a2.tar.bz2
otp-77cad6b3b87e5c073040ec71f42683e8da6847a2.zip
Avoid calling absname/1 on an absolute path
absname/1 is quite expensive, so we should not call if we already have a normalized absolute path.
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/code_server.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index 5fd434e323..4579ac57e1 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -1160,8 +1160,13 @@ mod_to_bin([Dir|Tail], Mod) ->
case erl_prim_loader:get_file(File) of
error ->
mod_to_bin(Tail, Mod);
- {ok,Bin,FName} ->
- {Mod,Bin,absname(FName)}
+ {ok,Bin,_} ->
+ case filename:pathtype(File) of
+ absolute ->
+ {Mod,Bin,File};
+ _ ->
+ {Mod,Bin,absname(File)}
+ end
end;
mod_to_bin([], Mod) ->
%% At last, try also erl_prim_loader's own method