]> www.infradead.org Git - users/hch/xfs.git/commit
perf dsos: When adding a dso into sorted dsos maintain the sort order
authorIan Rogers <irogers@google.com>
Wed, 3 Jul 2024 17:21:17 +0000 (10:21 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Mon, 8 Jul 2024 05:26:29 +0000 (22:26 -0700)
commit7b2450bb40275802b73593331b0db2fc147ae2b7
tree8f0f4360e28d563309c0add92ccde22521272ee2
parent88076e4699ce490aabe89037190d4749ab346b29
perf dsos: When adding a dso into sorted dsos maintain the sort order

dsos__add would add at the end of the dso array possibly requiring a
later find to re-sort the array. Patterns of find then add were
becoming O(n*log n) due to the sorts. Change the add routine to be
O(n) rather than O(1) but to maintain the sorted-ness of the dsos
array so that later finds don't need the O(n*log n) sort.

Fixes: 3f4ac23a9908 ("perf dsos: Switch backing storage to array from rbtree/list")
Reported-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Steinar Gunderson <sesse@google.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Matt Fleming <matt@readmodwrite.com>
Link: https://lore.kernel.org/r/20240703172117.810918-3-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/dsos.c