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

feat: Go implementation for manifestYamlDoc and escapeStringJson #742

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jgraeger
Copy link

@jgraeger jgraeger commented Jan 26, 2024

This PR introduces native Go implementations for two standard library functions in Jsonnet: manifestYamlDoc and escapeStringJson. These enhancements are a response to performance challenges, especially noticeable in cases where quote_keys=false is set. This issue is documented in google/jsonnet#1019 and also holds for the Go implementation.

Benchmarks

Running Before Test... (10s)
Running After Test... (10s)
benchmark                                old ns/op     new ns/op     delta
Benchmark_Builtin_escapeStringJson-8     9061562       3082901       -65.98%
Benchmark_Builtin_manifestYamlDoc-8      12660395      3559494       -71.88%

On a large, non-public codebase generating megabytes of yaml from jsonnet, the runtime decreased from over 10 minutes to 8 seconds.

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.

None yet

1 participant