Skip to content

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.

@bdash bdash force-pushed the dsc-analysis-context-json-builder branch from d1b79cc to d5c48c9 Compare March 5, 2025 06:08
@bdash bdash force-pushed the dsc-analysis-context-json-builder branch 4 times, most recently from 449eb44 to 9c0ec48 Compare April 8, 2025 17:45
@bdash bdash force-pushed the dsc-analysis-context-json-builder branch from 9c0ec48 to 04131ba Compare May 7, 2025 13:58
@bdash bdash force-pushed the dsc-analysis-context-json-builder branch from 04131ba to 2890503 Compare May 14, 2025 18:44
@bdash bdash force-pushed the dsc-analysis-context-json-builder branch from 2890503 to 2b36e73 Compare May 22, 2025 20:14
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.
@bdash bdash force-pushed the dsc-analysis-context-json-builder branch from 2b36e73 to f3be26e Compare May 22, 2025 23:50
@plafosse plafosse added this to the Helion milestone May 27, 2025
@bpotchik
Copy link
Member

Thanks for highlighting this. I ended up swapping jsoncpp for rapidjson, and cleaning up the constructor. The Inform API also is changed to eliminate the std::variant as well.

@bpotchik bpotchik closed this May 28, 2025
@bdash bdash deleted the dsc-analysis-context-json-builder branch May 30, 2025 00:29
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.

3 participants