Skip to content

Commit

Permalink
Remove unnecessary memset in TVMMutableFuncRegistry initialization (a…
Browse files Browse the repository at this point in the history
…pache#8818)

Remove unnecessary memset() call in TVMMutableFuncRegistry_Create()
when initializing a TVMMutableFuncRegistry struct. All struct members
(registry.names, registry.funcs, and max_functions) are already
initialized properly before returning, hence some CPU cycles might be
saved (usually 12 bytes in a 32-bit platform and 24 bytes in a 64-bit
platform must be written with 0 by memset()).

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
  • Loading branch information
gromero authored and ylc committed Sep 29, 2021
1 parent 7515d33 commit 1c64962
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/runtime/crt/common/func_registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ tvm_crt_error_t TVMMutableFuncRegistry_Create(TVMMutableFuncRegistry* reg, uint8
return kTvmErrorBufferTooSmall;
}

memset(reg, 0, sizeof(*reg));
reg->registry.names = (const char*)buffer;
buffer[0] = 0; // number of functions present in buffer.
buffer[1] = 0; // end of names list marker.
Expand Down

0 comments on commit 1c64962

Please sign in to comment.