[SharedCache] Introduce a SymbolInfo type#6402
Closed
bdash wants to merge 1 commit into
Closed
Conversation
Previously `SharedCache` used a mixture of `pair<uint64_t, pair<BNSymbolType, std::string>>` and `Ref<Symbol>` to represent a symbol. The former is hard to understand due to the nesting and lack of names. The latter is expensive to create and its getters are expensive due to the multiple allocations + `strlen` calls needed when converting between core's string representation and `std::string`. `SymbolInfo` wraps the same data the nested pairs contained into a friendly struct with named fields. Beyond that it, it exposes an `AsSymbol` function to construct a `Ref<Symbol>` where that is what is required. Code within `SharedCache` is updated to work with `SymbolInfo` until it needs to call into a core API that requires a `Symbol`. This change is only a small performance improvement at the moment. It's more noticable once `SharedCache` no longer copies so much of its state (Vector35#6393).
Contributor
Author
|
I'll have to look at whether this is still worth doing given #6197. It may not be necessary. |
Contributor
Author
|
Constructing a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously
SharedCacheused a mixture ofpair<uint64_t, pair<BNSymbolType, std::string>>andRef<Symbol>to represent a symbol. The former is hard to understand due to the nesting and lack of names. The latter is expensive to create and its getters are expensive due to the multiple allocations +strlencalls performed when converting between core's string representation andstd::string.SymbolInfowraps the same data that the nested pairs contained in a friendly struct with named fields. Beyond that it, it exposes anAsSymbolfunction to construct aRef<Symbol>where that is what is required.Code within
SharedCacheis updated to work withSymbolInfountil it needs to call into a core API that requires aSymbol.This change is only a small performance improvement at the moment. It's more noticable once
SharedCacheno longer copies so much of its state (#6393).