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 several string copies and unnecessary heap allocations #3222

Merged
merged 6 commits into from
Aug 13, 2024

Conversation

eduar-hte
Copy link
Contributor

what

  • Remove several unnecessary heap allocations and copies in the library.
  • Inline string manipulation functions in src/utils/string.* by moving the definition of these functions into the header file.

why

The unnecessary heap allocations and copies take time and contribute to heap fragmentation (which also reduces performance over time).

misc

This is part of a series of PRs to improve performance of the library (3/n). Previous: #3218

eduar-hte and others added 5 commits August 9, 2024 12:52
…eate a new one to transform it

- Make functions inline to improve performance
- Introduced helper method toCaseHelper to remove code duplication
- Introduced helper method addVariableOrigin to reduce code duplication.
@eduar-hte eduar-hte changed the title Remove copies Remove several string copies and unnecessary heap allocations Aug 12, 2024
@marcstern marcstern added the 3.x Related to ModSecurity version 3.x label Aug 12, 2024
- Other minor changes reported by sonarcloud
Copy link

sonarcloud bot commented Aug 12, 2024

Copy link
Member

@airween airween left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Related to ModSecurity version 3.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants