Skip to content

Conversation

@kheaactua
Copy link
Contributor

@kheaactua kheaactua commented Apr 8, 2025

Without mandatory fields set, the previous code would hit many exceptions in the happy load case. Thus, instead of depending on exceptions to detect the existence of keys in the parsed json, this change optionals to check to see whether a key exists. This should improve performance* (no stack unrolling for the exception) as well as allows some try/catch blocks to be removed (simpler code.)

Another driver for this change was that 4913ae3 swapped ellipses in the catch statements for std::exception. On the surface this seems like a positive change and even follows compiler warning message recommendations, however for unknown reasons on some platforms catch (std::exception) would catch the boost::property_tree::ptree_bad_path exceptions thrown by get_child, and on other platforms it wouldn't. Even though there is a proposal to revert that commit (eventually committed in 9259c09), reducing dependence on exceptions in favour of optionals obviates this issue.

Not every try/catch block was removed here, simply the ones where there's no conceivable change of an exception being thrown. The blocks surrounding the streamstream converters, and map access were left just in case.

Performance

Using timing data from the log line Parsed vsomeip configuration in Xms, I saw the following improvements (sample size of n=1).

  qnx-baseline qnx-change aosp-baseline aosp-change
Arith. Mean 41.73 10.64 5.84 3.14
Std. 47.32 5.97 4.98 3.14

@kheaactua kheaactua changed the title Ignore CMakeUserPresets.json Improving error handing when reading json config Apr 8, 2025
@kheaactua kheaactua force-pushed the remove_config_exceptions branch 3 times, most recently from 61dbfad to 6a68bfe Compare April 8, 2025 19:53
@kheaactua kheaactua force-pushed the remove_config_exceptions branch 2 times, most recently from f08ca43 to 85542c0 Compare April 8, 2025 20:37
@kheaactua kheaactua force-pushed the remove_config_exceptions branch 2 times, most recently from 659cffc to 9f498b9 Compare May 23, 2025 16:59
@kheaactua kheaactua force-pushed the remove_config_exceptions branch from 9f498b9 to 83a538d Compare June 17, 2025 13:27
Without mandatory fields set, the previous code would hit many
exceptions in the happy load case. Thus, instead of depending on
exceptions to detect the existence of keys in the parsed json, this
change optionals to check to see whether a key exists.  This should
improve performance (no stack unrolling for the exception) as well as
allows some try/catch blocks to be removed (simpler code.)
@kheaactua kheaactua force-pushed the remove_config_exceptions branch from 83a538d to b51830d Compare July 31, 2025 21:47
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