Skip to content

Implement JSON string escape in pure-awk (several orders of magnitude faster) #48

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

Merged

Conversation

tianon
Copy link
Member

@tianon tianon commented Jul 13, 2022

I've got a very pathological branch of a certain repository where this makes a parallelized (four concurrent invocations) generation change from ~3 minutes down to ~13 seconds.

I did not implement \b or \f because I don't think the chances of them occurring naturally in a text document (especially a Dockerfile) in 2022+ are very high. 😅

(Also, this isn't required to be pure JSON, but rather "jq compatible" as it's used as jq syntax so we have a little bit more wiggle room as jq is more forgiving than a pure strict parser)

… faster)

I've got a very pathological branch of a certain repository where this makes a parallelized (four concurrent invocations) generation change from ~3 _minutes_ down to ~13 _seconds_.
@codecov-commenter
Copy link

Codecov Report

Merging #48 (9f6a357) into master (92ab34b) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master      #48   +/-   ##
=======================================
  Coverage   76.83%   76.83%           
=======================================
  Files           5        5           
  Lines         587      587           
=======================================
  Hits          451      451           
  Misses        104      104           
  Partials       32       32           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 92ab34b...9f6a357. Read the comment docs.

@tianon
Copy link
Member Author

tianon commented Jul 13, 2022

Just running ./apply-templates.sh on PHP takes ~2 minutes currently and ~6 seconds with this change.

@tianon tianon merged commit 3a1bc49 into docker-library:master Jul 13, 2022
@tianon tianon deleted the pure-awk-json-string-escaping branch July 13, 2022 23:56
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