Skip to content

[Comgr] Resolve symbols through a cached parse and name index - #3841

Draft
chinmaydd wants to merge 1 commit into
amd/dev/chdeshpa/comgr-metadata-cachefrom
amd/dev/chdeshpa/comgr-symbol-index
Draft

[Comgr] Resolve symbols through a cached parse and name index#3841
chinmaydd wants to merge 1 commit into
amd/dev/chdeshpa/comgr-metadata-cachefrom
amd/dev/chdeshpa/comgr-symbol-index

Conversation

@chinmaydd

@chinmaydd chinmaydd commented Aug 10, 2026

Copy link
Copy Markdown

This is second in a series of PRs that improves Comgr.

Every amd_comgr_symbol_lookup re-parsed the ELF and linearly scanned all symbols, so m lookups on an n-symbol object cost m parses and m*n comparisons. amd_comgr_iterate_symbols re-parsed too, including when driven internally by amd_comgr_populate_mangled_names.

Cache the parsed object file on the DataObject and build a name index once. First occurrence still wins for lookup; iteration order, count and per-callback handle allocation are unchanged.

200000 repeat lookups on shared-v3.so (4 symbols): 129 ms -> 25 ms.

[1/3] <- #3840
[2/3] <- you are here
[3/3] <- #3842

Every amd_comgr_symbol_lookup re-parsed the ELF and linearly scanned all symbols, so m lookups on an n-symbol object cost m parses and m*n comparisons. amd_comgr_iterate_symbols re-parsed too, including when driven internally by amd_comgr_populate_mangled_names.

Cache the parsed object file on the DataObject and build a name index once. First occurrence still wins for lookup; iteration order, count and per-callback handle allocation are unchanged.

200000 repeat lookups on shared-v3.so (4 symbols): 129 ms -> 25 ms.

Co-authored-by: Cursor <cursoragent@cursor.com>
@chinmaydd
chinmaydd force-pushed the amd/dev/chdeshpa/comgr-symbol-index branch from b477fa7 to 377a047 Compare August 10, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comgr Related to Code Object Manager

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant