Skip to content

Conversation

marschall
Copy link
Contributor

@marschall marschall commented Aug 23, 2021

Optimize ExitStatus#addExitDescription by reducing string allocations
through:

  • avoid string allocation when the current description is empty
  • avoid string allocation when the given description is empty
  • avoid intermediate string allocation by allocating the correct buffer size

When profiling the string allocations in ExitStatus#addExitDescription where showing up. They were mostly showing up through ExitStatus#and(ExitStatus).

ExitStatus-addExitDescription

Optimize ExitStatus#addExitDescription by reducing string allocations
through:

- avoid string allocation when the current description is empty
- avoid string allocation when the given description is empty
- avoid intermediate string allocation by allocating the correct buffer size
@fmbenhassine fmbenhassine modified the milestones: 5.1.0, 5.0.1 Feb 13, 2023
@fmbenhassine fmbenhassine added the for: backport-to-4.3.x Issues that will be back-ported to the 4.3.x line label Feb 13, 2023
fmbenhassine pushed a commit that referenced this pull request Feb 13, 2023
Optimize ExitStatus#addExitDescription by reducing string allocations
through:

- avoid string allocation when the current description is empty
- avoid string allocation when the given description is empty
- avoid intermediate string allocation by allocating the correct buffer size

Issue #3979
@fmbenhassine
Copy link
Contributor

I love this kind of optimisations! LGTM 👍 Rebased and merged as b38226e. Thank you for your contribution!

fmbenhassine pushed a commit that referenced this pull request Feb 13, 2023
Optimize ExitStatus#addExitDescription by reducing string allocations
through:

- avoid string allocation when the current description is empty
- avoid string allocation when the given description is empty
- avoid intermediate string allocation by allocating the correct buffer size

Issue #3979
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: backport-to-4.3.x Issues that will be back-ported to the 4.3.x line in: core pr-for: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants