File 0151-stdlib-Optimize-gen-a-little.patch of Package erlang
From f842cf786897a48451c5b9d684c5ab0a30a18b16 Mon Sep 17 00:00:00 2001
From: Hans Bolinder <hasse@erlang.org>
Date: Fri, 1 Dec 2017 11:40:18 +0100
Subject: [PATCH 2/2] stdlib: Optimize gen a little
---
lib/stdlib/src/gen.erl | 4 ++++
1 file changed, 4 insertions(+)
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,
--
2.15.1