Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Further refine Optimization Detective integration with build process and PL plugin#1082

Merged
felixarntz merged 6 commits into
trunkfrom
update/optimization-detective-merge
Mar 25, 2024
Merged

Further refine Optimization Detective integration with build process and PL plugin#1082
felixarntz merged 6 commits into
trunkfrom
update/optimization-detective-merge

Conversation

@westonruter

@westonruter westonruter commented Mar 22, 2024

Copy link
Copy Markdown
Member

This PR addresses non-blocking code review feedback from @felixarntz in #1079 (review).

  • Eliminate reuse of output buffering from Optimization Detective in the Server-Timing functionality. See Merge Optimization Detective into trunk #1079 (comment).
  • Remove parallel arg to PHPCS. I tested this and it doesn't seem to help here in Performance Lab. It may be due to the AMP plugin having many more PHP files being tested at once where it then makes an impact. I'm reverting in Further refine Optimization Detective integration with build process and PL plugin #1082.
  • Locate the web-vitals.js script in a build directory, and update .gitignore and phpcs.xml.dist to ignore such build directories rather than the specific files that reside in them.
  • Move detection/detect.js out of the subdirectory since it was the only file located now located there.

@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature [Plugin] Optimization Detective Issues for the Optimization Detective plugin skip changelog PRs that should not be mentioned in changelogs labels Mar 22, 2024
@westonruter westonruter added the no milestone PRs that do not have a defined milestone for release label Mar 22, 2024
@westonruter westonruter force-pushed the update/optimization-detective-merge branch from 2964a91 to 9afee62 Compare March 23, 2024 04:19
@westonruter westonruter force-pushed the update/optimization-detective-merge branch from efbc82a to b653d57 Compare March 23, 2024 04:29
@westonruter westonruter requested a review from thelovekesh March 23, 2024 04:29
@westonruter westonruter marked this pull request as ready for review March 23, 2024 04:29
@westonruter westonruter requested a review from felixarntz as a code owner March 23, 2024 04:29
@github-actions

github-actions Bot commented Mar 23, 2024

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: thelovekesh <[email protected]>
Co-authored-by: mukeshpanchal27 <[email protected]>
Co-authored-by: felixarntz <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Comment thread phpcs.xml.dist
</rule>

<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it should be moved to phpcs.ruleset.xml and removed from anywhere else.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Without parallel execution
➜  performance git:(update/optimization-detective-merge) ✗ composer lint:all          
> build-cs/vendor/bin/phpcs
............... 15 / 15 (100%)


Time: 541ms; Memory: 22MB

> build-cs/vendor/bin/phpcs '--' './plugins/auto-sizes' '--standard=./plugins/auto-sizes/phpcs.xml.dist'
.. 2 / 2 (100%)


Time: 88ms; Memory: 14MB

> build-cs/vendor/bin/phpcs '--' './plugins/dominant-color-images' '--standard=./plugins/dominant-color-images/phpcs.xml.dist'
..... 5 / 5 (100%)


Time: 176ms; Memory: 16MB

> build-cs/vendor/bin/phpcs '--' './plugins/embed-optimizer' '--standard=./plugins/embed-optimizer/phpcs.xml.dist'
.. 2 / 2 (100%)


Time: 96ms; Memory: 16MB

> build-cs/vendor/bin/phpcs '--' './plugins/optimization-detective' '--standard=./plugins/optimization-detective/phpcs.xml.dist'
............... 15 / 15 (100%)


Time: 488ms; Memory: 20MB

> build-cs/vendor/bin/phpcs '--' './plugins/speculation-rules' '--standard=./plugins/speculation-rules/phpcs.xml.dist'
..... 5 / 5 (100%)


Time: 167ms; Memory: 16MB

> build-cs/vendor/bin/phpcs '--' './plugins/webp-uploads' '--standard=./plugins/webp-uploads/phpcs.xml.dist'
...... 6 / 6 (100%)


Time: 288ms; Memory: 22MB
With parallel execution
➜  performance git:(update/optimization-detective-merge) ✗ composer lint:all
> build-cs/vendor/bin/phpcs
............... 15 / 15 (100%)


Time: 162ms; Memory: 12MB

> build-cs/vendor/bin/phpcs '--' './plugins/auto-sizes' '--standard=./plugins/auto-sizes/phpcs.xml.dist'
.. 2 / 2 (100%)


Time: 80ms; Memory: 12MB

> build-cs/vendor/bin/phpcs '--' './plugins/dominant-color-images' '--standard=./plugins/dominant-color-images/phpcs.xml.dist'
..... 5 / 5 (100%)


Time: 93ms; Memory: 12MB

> build-cs/vendor/bin/phpcs '--' './plugins/embed-optimizer' '--standard=./plugins/embed-optimizer/phpcs.xml.dist'
.. 2 / 2 (100%)


Time: 84ms; Memory: 12MB

> build-cs/vendor/bin/phpcs '--' './plugins/optimization-detective' '--standard=./plugins/optimization-detective/phpcs.xml.dist'
............... 15 / 15 (100%)


Time: 150ms; Memory: 12MB

> build-cs/vendor/bin/phpcs '--' './plugins/speculation-rules' '--standard=./plugins/speculation-rules/phpcs.xml.dist'
..... 5 / 5 (100%)


Time: 102ms; Memory: 12MB

> build-cs/vendor/bin/phpcs '--' './plugins/webp-uploads' '--standard=./plugins/webp-uploads/phpcs.xml.dist'
...... 6 / 6 (100%)


Time: 147ms; Memory: 12MB

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh right. That explains why I wasn't seeing a performance improvement since it wasn't in the shared ruleset.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Moved in 5e55363

Comment thread phpcs.ruleset.xml
<rule ref="SlevomatCodingStandard.Functions.StaticClosure" />

<!-- Exclude built plugins and built assets in plugins. -->
<exclude-pattern>./build/*</exclude-pattern>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice. Should we also move node_modules and vendor here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think so because those directories are exclusively in the root of the repo and aren't also in the plugin subdirectories.

Comment thread phpcs.ruleset.xml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@felixarntz @westonruter This file serves no purpose at the root of the project. Should we move it to bin/phpcs, just like Webpack utils?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good idea. Moved in 931ad51.

@mukeshpanchal27 mukeshpanchal27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @westonruter for the PR.

In detect.js can we reuse const { log, formats } = require( '../lib/logger' ); and remove the console related function?

@westonruter

Copy link
Copy Markdown
Member Author

In detect.js can we reuse const { log, formats } = require( '../lib/logger' ); and remove the console related function?

Actually no because this is a standalone unbuilt ESM module used on the frontend, not a CommonJS module used in node CLI.

@mukeshpanchal27

Copy link
Copy Markdown
Member

In detect.js can we reuse const { log, formats } = require( '../lib/logger' ); and remove the console related function?

Actually no because this is a standalone unbuilt ESM module used on the frontend, not a CommonJS module used in node CLI.

Got it.

@felixarntz felixarntz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @westonruter!

@felixarntz felixarntz merged commit 5e570fa into trunk Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no milestone PRs that do not have a defined milestone for release [Plugin] Optimization Detective Issues for the Optimization Detective plugin skip changelog PRs that should not be mentioned in changelogs [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants