perf(common): drop discarded PeSymbolProvider.parseSymbols in getImportedFunctions#48
Conversation
…rtedFunctions getImportedFunctions() instantiated PeSymbolProvider(None) and called parseSymbols(lief_result) only to throw the return value away, then spun up a second PeSymbolProvider(None) just to call parseImports. parseSymbols walks lief_binary.symbols and builds a function_symbols dict; with no `self` mutation (it returns the dict), that work is purely wasted whenever getImportedFunctions is called. This removes the dead call. parseSymbols still runs from getSymbols() and from PeSymbolProvider.update(), so symbol parsing is unchanged for the callers that actually use it. ELF path is untouched. Validation: - pytest tests/test* -> 111 passed, 79 subtests passed - ruff check + format --check clean
|
Important Review skippedAuto reviews are disabled on this repository. To trigger a review, include ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Picks up a deferred item from PR #46/47 final reports:
BinaryInfo.getImportedFunctions()instantiatedPeSymbolProvider(None).parseSymbols(lief_result)and threw away the return value before spinning up a secondPeSymbolProvider(None)just to callparseImports. The first call walkedlief_binary.symbolsand built a function-symbol dict for nothing.This removes the wasted call.
parseSymbolsis still invoked fromgetSymbols()and fromPeSymbolProvider.update(), so symbol parsing is unchanged for callers that actually need it.Behavior compatibility
getImportedFunctions()still returns the same dict (it was always theparseImportsreturn value).getSymbols()unchanged.Test plan
python -m pytest tests/test*— 111 passed, 79 subtests passedpython -m ruff check .— cleanpython -m ruff format --check .— cleanhttps://claude.ai/code/session_01C8CcS2k1g59ByLKYdEcaxR
Generated by Claude Code