Skip to content

Conversation

bzp2010
Copy link
Collaborator

@bzp2010 bzp2010 commented Jul 17, 2025

Description

Replace the yaml library with js-yaml, which provides at least an order of magnitude performance improvement.
(2.85MB document, 1.3s => 0.19s)

We now explicitly provide JSON input support.
We used to use the yaml to provide fallback handling for JSON, but it was very slow. Now we've moved to using nodejs' built-in JSON.parse function, which uses the simdjson library under the hood. It's two orders of magnitude faster than using yaml's fallback strategy for JSON.
(2.39MB document, 1.17s => 0.03s)

To benefit from faster JSON parsing, you need to specify files with a .json extension. Files parsed with other extensions still use the fallback strategy of the js-yaml library.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible

@bzp2010 bzp2010 added test/api7 Trigger the API7 test on the PR test/apisix-standalone Trigger the APISIX standalone test on the PR labels Jul 17, 2025
@bzp2010 bzp2010 merged commit 2015486 into main Jul 17, 2025
60 checks passed
@bzp2010 bzp2010 deleted the bzp/feat-support-json-input branch July 17, 2025 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test/api7 Trigger the API7 test on the PR test/apisix-standalone Trigger the APISIX standalone test on the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants