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

Roast v0.5.0, faster input conversion #1293

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

anderseknert
Copy link
Member

Using the new ToOPAInput function from RoAST cuts the number of allocations related to input transformation in half.

This doesn't constitute a bottleneck for command line linting, but will help the language server process files as quickly as possible on changes.

Also convert a few bytes/string conversions to allocation-free variants. I don't think these matter much, but having them around will help remind us that's an option for when it does matter.

Using the new `ToOPAInput` function from RoAST cuts the number
of allocations related to input transformation in half.

This doesn't constitute a bottleneck for command line linting,
but will help the language server process files as quickly as
possible on changes.

Also convert a few bytes/string conversions to allocation-free
variants. I don't think these matter much, but having them around
will help remind us that's an option for when it does matter.

Signed-off-by: Anders Eknert <[email protected]>
@@ -133,7 +134,7 @@ func Plan(ctx context.Context, path, rego string, usePrint bool) (string, error)
{
URL: "/url",
Path: path,
Raw: []byte(rego),
Copy link
Member

Choose a reason for hiding this comment

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

So there's one direction where no copy or allocation is happening, and I believe it's string -> []byte. Random SO answer. So does StringToByteSlice actually do something for us? 🤔

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