Avoid unnecessery calls to eblake2

We frequently need identifier of init function. Store it precalculated
in headers.
This commit is contained in:
Artur Puzio 2021-03-22 15:10:15 +01:00
parent 9d81358daf
commit b30f8a2bfd
No known key found for this signature in database
GPG Key ID: D87762204CFFE72F
2 changed files with 5 additions and 3 deletions

View File

@ -82,6 +82,9 @@
-define(FATE_EMPTY_STRING, <<>>). -define(FATE_EMPTY_STRING, <<>>).
-define(FATE_STRING(S), S). -define(FATE_STRING(S), S).
-define(FATE_VARIANT(Arity, Tag,T), {variant, Arity, Tag, T}). -define(FATE_VARIANT(Arity, Tag,T), {variant, Arity, Tag, T}).
% Result of aeb_fate_code:symbol_identifier(<<"init">>).
% Stored here to avoid repeated calls to eblake2
-define(FATE_INIT_ID, <<68,214,68,31>>).
-define(MAKE_FATE_INTEGER(X), X). -define(MAKE_FATE_INTEGER(X), X).
-define(MAKE_FATE_LIST(X), X). -define(MAKE_FATE_LIST(X), X).

View File

@ -95,9 +95,8 @@ insert_annotation(comment =_Type, Line, Comment, FCode) ->
strip_init_function(#fcode{ functions = Funs, strip_init_function(#fcode{ functions = Funs,
symbols = Syms } = FCode) -> symbols = Syms } = FCode) ->
Id = symbol_identifier(<<"init">>), Funs1 = maps:remove(?FATE_INIT_ID, Funs),
Funs1 = maps:remove(Id, Funs), Syms1 = maps:remove(?FATE_INIT_ID, Syms),
Syms1 = maps:remove(Id, Syms),
FCode#fcode{ functions = Funs1, symbols = Syms1 }. FCode#fcode{ functions = Funs1, symbols = Syms1 }.
%%%=================================================================== %%%===================================================================