aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-12-21 10:01:29 +0100
committerHans Bolinder <[email protected]>2017-12-21 10:01:29 +0100
commit324265a52cf196d984af65563b1a0662f0164a30 (patch)
tree002bcb20e3267ba0928eccb542ac06dc088332bd /lib/stdlib/src
parent7d90b6956c383b85823782b46aa8f634910ac408 (diff)
parentf842cf786897a48451c5b9d684c5ab0a30a18b16 (diff)
downloadotp-324265a52cf196d984af65563b1a0662f0164a30.tar.gz
otp-324265a52cf196d984af65563b1a0662f0164a30.tar.bz2
otp-324265a52cf196d984af65563b1a0662f0164a30.zip
Merge branch 'hasse/stdlib/gen_server_bench'
* hasse/stdlib/gen_server_bench: stdlib: Optimize gen a little stdlib: Introduce gen_server benchmark
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r--lib/stdlib/src/gen.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/stdlib/src/gen.erl b/lib/stdlib/src/gen.erl
index 4b1d448487..0e6f49d99f 100644
--- a/lib/stdlib/src/gen.erl
+++ b/lib/stdlib/src/gen.erl
@@ -148,6 +148,10 @@ init_it2(GenMod, Starter, Parent, Name, Mod, Args, Options) ->
call(Process, Label, Request) ->
call(Process, Label, Request, ?default_timeout).
+%% Optimize a common case.
+call(Process, Label, Request, Timeout) when is_pid(Process),
+ Timeout =:= infinity orelse is_integer(Timeout) andalso Timeout >= 0 ->
+ do_call(Process, Label, Request, Timeout);
call(Process, Label, Request, Timeout)
when Timeout =:= infinity; is_integer(Timeout), Timeout >= 0 ->
Fun = fun(Pid) -> do_call(Pid, Label, Request, Timeout) end,