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

core: improve expr.toString performance #1706

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

brharrington
Copy link
Contributor

Creating a string from the expression can be a common operation when creating messages. This change reduces the overhead by allowing it to be written to an existing builder instance and reduce the amount of internal resizing and copies.

Before

Benchmark           Mode  Cnt         Score       Error  Units
withEscapes        thrpt   10    581,213.514 ± 4708.897  ops/s
withNoEscapes      thrpt   10    643,706.596 ± 9144.301  ops/s

After

Benchmark           Mode  Cnt         Score       Error  Units
withEscapes        thrpt   10    956,439.595 ±  5243.582  ops/s
withNoEscapes      thrpt   10  1,031,542.340 ± 25261.261  ops/s

Creating a string from the expression can be a common
operation when creating messages. This change reduces
the overhead by allowing it to be written to an existing
builder instance and reduce the amount of internal
resizing and copies.

**Before**

```
Benchmark           Mode  Cnt         Score       Error  Units
withEscapes        thrpt   10    581,213.514 ± 4708.897  ops/s
withNoEscapes      thrpt   10    643,706.596 ± 9144.301  ops/s
```

**After**

```
Benchmark           Mode  Cnt         Score       Error  Units
withEscapes        thrpt   10    956,439.595 ±  5243.582  ops/s
withNoEscapes      thrpt   10  1,031,542.340 ± 25261.261  ops/s
```
@brharrington brharrington added this to the 1.8.0 milestone Oct 15, 2024
@brharrington brharrington merged commit 0dea833 into Netflix:main Oct 15, 2024
5 checks passed
@brharrington brharrington deleted the escape-perf branch October 15, 2024 18:36
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