You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Related to Martin's report in #8322
It seems that gen:do_call got about 10% slower on OTP27. It is very hard to deduce what could cause this.
I extracted a super simple gen_statem to show the behaviour. The total code is not much slower, but the calls to gen:do_call are according to eprof.
I avoid mixing in the binary_to_term and other operations that happen in the state machine in riak this comes from. The production state machine gets far slower in time than this one, but theat might be due to other parts as well.
To Reproduce
This little program shows a difference:
-module(lll).
-compile([export_all, nowarn_export_all]).
test(N) ->
erlang:garbage_collect(),
Term = [ {I, crypto:strong_rand_bytes(256)} || I <- lists:seq(1, 1_000)],
%% N copies of the same binary
Bin = term_to_binary(Term),
{ok, Pid} = start(Bin),
eprof:start(),
eprof:start_profiling([Pid, self()]),
%% make a lot of calls
run(N, Pid),
eprof:stop_profiling(),
gen_statem:stop(Pid),
eprof:analyze(total, [{filter, [{calls, 10}]}]),
eprof:stop().
run(0, _) ->
ok;
run(N, Pid) ->
gen_statem:call(Pid, N),
run(N-1, Pid).
%% -- gen_statem
callback_mode() ->
state_functions.
start(Binary) ->
gen_statem:start_link(?MODULE, Binary, []). %% possibly need start options
init(Binary) ->
{ok, started, Binary}.
started({call, From}, Msg, State) ->
P = 8 * (Msg rem size(State)),
<<_:P, Bin/binary>> = State,
{keep_state_and_data, [{reply, From, Bin}]}.
On OTP-26.2.1 it takes about 425945 us for 1 million calls
Expected behavior
Possibly not as much performance difference as this.
Affected versions
This is OTP27. Most likely later than commit 49024e8, because there it still works equally fast, whereas the next commit make it slower, but then it gets even slower later on.
The text was updated successfully, but these errors were encountered:
Describe the bug
Related to Martin's report in #8322
It seems that
gen:do_call
got about 10% slower on OTP27. It is very hard to deduce what could cause this.I extracted a super simple gen_statem to show the behaviour. The total code is not much slower, but the calls to
gen:do_call
are according toeprof
.I avoid mixing in the
binary_to_term
and other operations that happen in the state machine in riak this comes from. The production state machine gets far slower in time than this one, but theat might be due to other parts as well.To Reproduce
This little program shows a difference:
On OTP-26.2.1 it takes about 425945 us for 1 million calls
whereas on master (i.e. commit 8504..):
it takes 100000us more.
Expected behavior
Possibly not as much performance difference as this.
Affected versions
This is OTP27. Most likely later than commit 49024e8, because there it still works equally fast, whereas the next commit make it slower, but then it gets even slower later on.
The text was updated successfully, but these errors were encountered: