Skip to content

Conversation

@anderseknert
Copy link
Member

This is a marginal improvement, but considering this is one of the most called functions in OPA, the overall impact is still substantial. Concretely, this simple change reduces the number of allocations done in the regal lint bundle benchmark by about 655K(!)

main vs. change

BenchmarkRefString/SingleTerm-12     56586423      20.70 ns/op       16 B/op      1 allocs/op
BenchmarkRefString/SingleTerm-12     581425396      2.07 ns/op        0 B/op      0 allocs/op

@anderseknert anderseknert force-pushed the perf-single-term-ref-str branch from 419879a to 9b5a83d Compare May 19, 2025 13:03
Copy link
Contributor

@johanfylling johanfylling left a comment

Choose a reason for hiding this comment

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

LGTM

This is a marginal improvement, but considering this is one of the most
called functions in OPA, the overall impact is still substantial. Concretely,
this simple change reduces the number of allocations done in the
`regal lint bundle` benchmark by about 655K(!)

**main vs. change**
```
BenchmarkRefString/SingleTerm-12     56586423      20.70 ns/op       16 B/op      1 allocs/op
BenchmarkRefString/SingleTerm-12     581425396      2.07 ns/op        0 B/op      0 allocs/op
```

Signed-off-by: Anders Eknert <[email protected]>
@anderseknert anderseknert force-pushed the perf-single-term-ref-str branch from 9b5a83d to 59d4e71 Compare May 19, 2025 13:49
@anderseknert anderseknert merged commit 5514ee3 into open-policy-agent:main May 19, 2025
28 checks passed
aromeyer pushed a commit to aromeyer/opa that referenced this pull request May 21, 2025
…#7595)

This is a marginal improvement, but considering this is one of the most
called functions in OPA, the overall impact is still substantial. Concretely,
this simple change reduces the number of allocations done in the
`regal lint bundle` benchmark by about 655K(!)

**main vs. change**
```
BenchmarkRefString/SingleTerm-12     56586423      20.70 ns/op       16 B/op      1 allocs/op
BenchmarkRefString/SingleTerm-12     581425396      2.07 ns/op        0 B/op      0 allocs/op
```

Signed-off-by: Anders Eknert <[email protected]>
Signed-off-by: aromeyer <[email protected]>
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.

2 participants