Skip to content

Build/Test Tools: Improve performance of bcrypt related unit tests in the 6.8 branch - #13018

Open
lucatume wants to merge 2 commits into
WordPress:6.8from
lucatume:backport/63026-bcrypt-test-cost-6.8
Open

Build/Test Tools: Improve performance of bcrypt related unit tests in the 6.8 branch#13018
lucatume wants to merge 2 commits into
WordPress:6.8from
lucatume:backport/63026-bcrypt-test-cost-6.8

Conversation

@lucatume

@lucatume lucatume commented Aug 12, 2026

Copy link
Copy Markdown

6.8 branched on 2025-03-25, before [60253] and [60298] landed on trunk under #63026, so it's the only branch that ships bcrypt password hashing without the accompanying test suite cost reductions. 6.7 and earlier predate bcrypt; 6.9 and later inherited both changesets.

Every PHP version pays for it. Median job duration, run 31596990187 on 6.8 against run 31600298705 on 6.9, an hour apart on matrices of the same size:

PHP 6.8 6.9
7.2 818s 754s
7.4 807s 768s
8.0 825s 752s
8.3 855s 790s

PHP 8.4 is worse again, because it raised the default bcrypt cost from 10 to 12 while [60298] pins the test cost to 5. On PHP 8.4 / MySQL 8.4 example.org:8889, the one job name common to both branches, the Run PHPUnit tests step takes 999s on 6.8 and 701s on 6.9. That job is left out of the table above because 6.9 runs PHP 8.4 only on the two example.org:8889 variants, so a median would compare 26 jobs against 2.

That tail is what breaks the run. Three jobs exceeded timeout-minutes and were cancelled, which dispatched failed-workflow.yml and reran the run, for 51m18s of wall clock against 18m32s for 6.9. p90 was 1134s against 829s.

This merges both trunk changes so 6.8's suite matches 6.9's:

Both applied without conflict.

Two things for review:

reduce_hash_cost() now produces cost 4, PHP's minimum, which is why the pinned cost is 5 and not 4.

[60253] touches 28 test files that have had 16 months to drift on this branch. The merge was clean, but that only means the text lined up. The CI run on this PR is the real check, and breakage would most likely show as order dependence in the customize and meta suites.

Trac ticket: https://core.trac.wordpress.org/ticket/65861


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

…crypt hashing.

Merges [60253] to the 6.8 branch.

User creation is more expensive on 6.8 since the switch to bcrypt hashing, and users created in wpSetUpBeforeClass fixtures hash at PHP's full default cost. Moving per-test user creation into shared fixtures cuts how many of those hashes the suite performs.

Props peterwilsoncc, johnbillion.
See #63026.
…peed up tests.

Merges [60298] to the 6.8 branch.

6.8 hashes test user passwords at PHP's default bcrypt cost, which PHP 8.4 raised from 10 to 12. PHPUnit jobs on PHP 8.4 run to a median of 1118 seconds against 820 for PHP 7.2, 7.4 and 8.0, and hit the workflow timeout often enough to trigger an automatic rerun.

The lowest allowable cost in PHP is 4, so 5 is used, which leaves test_wp_check_password_supports_hash_with_reduced_bcrypt_cost() room to reduce the cost by one.

Props johnbillion.
See #63026.
@github-actions

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props lucatume.

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

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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.

1 participant