Skip to content

Conversation

@CharityKathure
Copy link
Contributor

@CharityKathure CharityKathure commented Oct 19, 2024

Description

This PR refactors the JSON file parsing logic in the codebase, replacing custom parsers with the more robust and efficient Boost.JSON library. The switch to Boost.JSON simplifies the code by leveraging a well-maintained and high-performance library, improving maintainability, readability, and performance.

STDOUT after change:
image

@CharityKathure CharityKathure force-pushed the boost-parsing branch 2 times, most recently from 14cee0e to 9ea9ef9 Compare October 19, 2024 02:42
@CharityKathure CharityKathure marked this pull request as ready for review October 19, 2024 02:53

const boost::json::array& providers = source.at("providers").as_array();
for (const auto& provider : providers) {
std::string providerName = provider.as_object().at("providerName").as_string().c_str();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qq: btw, what happens when someone mixes the cases the names eg. ProviderName instead of providerName?


// Process channels if they exist
if (source.as_object().contains("channels")) {
std::vector<EventLogChannel>* channels = new std::vector<EventLogChannel>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we avoid dynamic memory memory management because of memory leaks?
https://learnmoderncpp.com/2024/08/05/memory-allocation-techniques-in-modern-c/

)
);

std::shared_ptr<SourceProcess> sourceProcess = std::make_shared< SourceProcess>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::unique_ptr perhaps since ownership is not shared?

Signed-off-by: Charity Kathure <ckathure@microsoft.com>
Signed-off-by: Charity Kathure <ckathure@microsoft.com>
Signed-off-by: Charity Kathure <ckathure@microsoft.com>
@CharityKathure
Copy link
Contributor Author

CharityKathure commented Nov 7, 2024

Closing this PR to open a new one targeting a branch specifically for version 2.2.0rc.: #202

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.

4 participants