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

[7.x] Minor optimisations on isJson function #619

Merged
merged 5 commits into from
Oct 11, 2024

Conversation

indykoning
Copy link
Contributor

Profiling i noticed (in my case) jsJson is called over 10k times in the code, causing wall time to be quite high.
On large strings json_decode is a heavy operation, if we perform some simpler string checks we can hopefully reduce some json_decode operations.

once https://www.php.net/manual/en/function.json-validate.php can be used this can further optimise the check since it's what json_decode uses before actually attempting to decode, thus we can skip the decoding itself.

@indykoning indykoning changed the title Minor optimisations on isJson function [7.x] Minor optimisations on isJson function Sep 30, 2024
Copy link
Member

@duncanmcclean duncanmcclean left a comment

Choose a reason for hiding this comment

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

Thanks!

@duncanmcclean duncanmcclean merged commit 6f50d54 into statamic-rad-pack:7.x Oct 11, 2024
6 checks passed
Copy link

Released as part of v7.11.0.

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