Skip to content
Commit d62a849a authored by SzuWei Lin's avatar SzuWei Lin
Browse files

libufdt: reduce the number of malloc/free calling

The performance of some bootloader malloc/free implementation isn't
optimized, but libufdt calls huge number of malloc/free to build a
real tree data structure.

The patch adds an ufdt_node_pool to reduce the number of malloc/free.
ufdt_node_pool asks a larger memory block in each time, and
distributes the memory into several ufdt_node (ufdt_node_fdt_prop
or ufdt_node_fdt_node). libufdt doesn't need to call malloc()
to allocate memory until out of larger memory block.

The setting of this patch is 1024 nodes in each memory block,
so it can reduce ~1023/1024 malloc/free calling times after the patch
is applied.

Bug: 32969430
Test: ./tests/run_tests.sh
Test: ./tests/run_performance_test.sh
Change-Id: Id95e74da1235b9e2fc306500686515ee6b93017d
parent a3326ade
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment