[PATCH 1/6] kallsyms: Optimize multiple times of realloc() to one time of malloc()
Masahiro Yamada
masahiroy at kernel.org
Tue Jul 16 06:12:24 AEST 2024
On Thu, Jun 13, 2024 at 10:36 PM Zheng Yejian <zhengyejian1 at huawei.com> wrote:
>
> Array 'table' is used to store pointers of symbols that read from in.map
> file, and its size depends on the number of symbols. Currently 'table'
> is expanded by calling realloc() every 10000 symbols read.
>
> However, there generally are around 100000+ symbols, which means that
> the expansion is generally 10+ times.
>
> As an optimization, introduce linked list 'sym_list' to associate and
> count all symbols, then store them into 'table' at one time.
>
> Signed-off-by: Zheng Yejian <zhengyejian1 at huawei.com>
I do not think this is worthwhile.
realloc() is simple.
If this is a problem, you can increase the
"+= 10000" to "+= 65536" or something.
--
Best Regards
Masahiro Yamada
More information about the Linuxppc-dev
mailing list