Skip to content

Removing need for RegEx when expanding ENV variables#6312

Open
FracturedShader wants to merge 1 commit into
eProsima:masterfrom
FracturedShader:performance/expand-env-vars
Open

Removing need for RegEx when expanding ENV variables#6312
FracturedShader wants to merge 1 commit into
eProsima:masterfrom
FracturedShader:performance/expand-env-vars

Conversation

@FracturedShader

Copy link
Copy Markdown

When starting up several programs with STATIC EDP on embedded hardware, this routine dominates the startup time due to the RegEx recompilation and std::regex internally being locale aware. Especially when the EDP XML is fairly large.

This work replaces the RegEx with a small finite state machine that does a single linear pass over the input. Results from perf show this significantly reduces parsing time (as all text of interest is passed through this method).

Description

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • N/A Any new/modified methods have been properly documented using Doxygen.
  • N/A Any new configuration API has an equivalent XML API (with the corresponding XSD extension)
  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • Changes are API compatible.
  • N/A New feature has been added to the versions.md file (if applicable).
  • N/A New feature has been documented/Current behavior is correctly described in the documentation.
  • N/A Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

When starting up several programs with STATIC EDP on embedded hardware,
this routine dominates the startup time due to the RegEx recompilation
and `std::regex` internally being locale aware. Especially when the EDP
XML is fairly large.

This work replaces the RegEx with a small finite state machine that does
a single linear pass over the input. Results from `perf` show this
significantly reduces parsing time (as all text of interest is passed
through this method).

Signed-off-by: Robert Plante <RobertDPlante@gmail.com>
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