Re: [PATCH 1/6] kallsyms: Optimize multiple times of realloc() to one time of malloc()
From: Masahiro Yamada
Date: Mon Jul 15 2024 - 16:13:12 EST
On Thu, Jun 13, 2024 at 10:36 PM Zheng Yejian <zhengyejian1@xxxxxxxxxx> 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@xxxxxxxxxx>
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