wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Performance: yoastseo research

Open igorschoester opened this issue 1 year ago • 2 comments

Context

  • Provide some tooling to get insight into research performance. This is the result of a performance hackathon, with some more polishing afterwards to be able get to this PR.

Summary

This PR can be summarized in the following changelog entry:

  • [@yoast/content-analysis-app] Add performance UI to test running researches.

Relevant technical choices:

  • Fix ESLint config being misaligned:
    • The .eslintrc in this root would not be picked up by the live linter
  • Adjust eslint config:
    • Use root: true to not let ESlint travel further
    • Adjust a two random rules because they triggered me
  • Batch of random fixes:
    • Select uses inputId instead of ID, use that for the label focus to work
    • Apply security fix for measure text width
    • Make the button container work on non-buttons too (so I can wrap a button)
  • Add performance
    • Preparing a researcher and a paper beforehand (inside the "container"). I first tried to run it via the worker but the scheduler makes for inaccurate timings due to the polling system. So either this or creating a timing system inside the worker, this seems the easiest approach for now.
    • Data is saved to the store, which is synced to the browser storage - hence the need for a clear button
    • Using the browser Performance API and kept the console logging in there (basically the MDN example, but in hook form -- added a prefix to not get spammed by React measures)

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Go to apps/content-analysis.
  • Run yarn install and yarn start.
  • Check out the new Performance collapsible:
    • You can select multiple researches to run.
    • If you click run it will loop over the researches and run a batch of each, the timing is per batch and then takes the average of that in case you run more batches later. Not sure if that makes sense TBH, but seems nice to not HAVE to reset if you change batch size?

Relevant test scenarios

  • [x] Changes should be tested with the browser console open
  • [ ] Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • [ ] Changes should be tested on different editors (Block/Classic/Elementor/other)
  • [ ] Changes should be tested on different browsers
  • [ ] Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • [ ] QA should use the same steps as above.

QA can test this PR by following these steps:

  • No need, this is pretty unrelated to the rest of the repo.

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • [ ] This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • [ ] This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • [ ] I have written documentation for this change.

Quality assurance

  • [x] I have tested this code to the best of my abilities.
  • [ ] During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • [ ] I have added unit tests to verify the code works as intended.
  • [ ] If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • [x] I have written this PR in accordance with my team's definition of done.
  • [x] I have checked that the base branch is correctly set.

Innovation

  • [x] No innovation project is applicable for this PR.
  • [ ] This PR falls under an innovation project. I have attached the innovation label.
  • [ ] I have added my hours to the WBSO document.

Fixes #

igorschoester avatar Dec 08 '23 15:12 igorschoester

Pull Request Test Coverage Report for Build 0c05b3e9ba2944229c99743ac7d16e316390c7fb

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on performance/yoast-seo-research at 56.402%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/yoastseo/src/languageProcessing/researches/getKeywordDensity.js 0 1 0.0%
<!-- Total: 0 1
Totals Coverage Status
Change from base Build 7fc2d4764c466fa860edf30577545e7b7aea6cce: 56.4%
Covered Lines: 13526
Relevant Lines: 23516

💛 - Coveralls

coveralls avatar Dec 28 '23 14:12 coveralls

Initial CR: Rebased to trunk, stop using the deprecated getKeyphraseDensity function -- we might want to remove that altogether. More CR to come next week 😄

mhkuu avatar Dec 28 '23 15:12 mhkuu

this is awesome 🤩

marinakoleva avatar Mar 07 '24 12:03 marinakoleva