Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove m_reader / m_builder members from AnalysisContext #6417

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

bdash
Copy link
Contributor

@bdash bdash commented Feb 14, 2025

Constructing these objects is very expensive compared to the cost of creating the AnalysisContext.

m_reader appears to be entirely unused so it is simply removed.

m_builder is only used within Inform. It may be appropriate to move it to a local variable within that function, but I'm not sure how often Inform is called. Given that the Json::StreamWriterBuilder is rather expensive to construct I've instead opted to make it static so it is initialized only on first use and then reused by later calls. Json::StreamWriterBuilder::newStreamWriter does not mutate any state so this seems ok in terms of thread-safety.

Constructing these objects are very expensive compared to the cost of
creating the `AnalysisContext`.

`m_reader` appears to be entirely unused so it is simply removed.

`m_builder` is only used within `Inform`. It may be appropriate to move
it to a local variable within that function, but I'm not sure how often
`Inform` is called. Given that the `Json::StreamWriterBuilder` is rather
expensive to construct I've instead opted to make it static so it is
initialized only on first use and then reused by later calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant