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

Add query to gather counts for types of inline scripts #64

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

Conversation

westonruter
Copy link
Collaborator

This allows us to determine the relative frequency of the types of inline scripts in WP_Scripts, namely before, after, extra (wp_localize_script()), and translations.

Output for July 2023:

Type Count Percentage
extra 25,082,363,691 65.26%
before 8,184,494,232 21.29%
after 3,782,332,149 9.84%
translations 1,384,873,280 3.60%
Total: 38,434,063,352  

Comment on lines +32 to +35
scriptTypes.push( (new Array( script.after_script_size )).fill( 'after' ) );
scriptTypes.push( (new Array( script.before_script_size )).fill( 'before' ) );
scriptTypes.push( (new Array( script.extra_script_size )).fill( 'extra' ) );
scriptTypes.push( (new Array( script.translations_script_size )).fill( 'translations' ) );
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since these metrics are already numbers, it does seem like this should rather be implemented to return a STRUCT and utilize SUM() rather than COUNT() in the query.

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