Skip to content

Runner: distribute files round-robin by size in parallel mode - #1421

Open
janedbal wants to merge 3 commits into
PHPCSStandards:4.xfrom
janedbal:4.x-balance-batches
Open

Runner: distribute files round-robin by size in parallel mode#1421
janedbal wants to merge 3 commits into
PHPCSStandards:4.xfrom
janedbal:4.x-balance-batches

Conversation

@janedbal

@janedbal janedbal commented Apr 28, 2026

Copy link
Copy Markdown

Description

Solves same problem as #1419 but with much simplier approach.

Measurements:

  • before: 3 mins 43 secs
  • after: 1 min 59 secs

(~22 400 PHP files, 24 workers)

Suggested changelog entry

  • --parallel mode now better distributes work; gains up to 50% speedup

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
    • This change is only breaking for integrators, not for external standards or end-users.
  • Documentation improvement

PR checklist

  • I have checked there is no other PR open for the same change.
  • I have read the Contribution Guidelines.
  • I grant the project the right to include and distribute the code under the BSD-3-Clause license (and I have the right to grant these rights).
  • I have added tests to cover my changes.
  • I have verified that the code complies with the projects coding standards.
  • [Required for new sniffs] I have added XML documentation for the sniff.
    • Not applicable
  • I have opened a sister-PR in the documentation repository to update the Wiki.
    • I believe not needed

@janedbal
janedbal marked this pull request as ready for review April 28, 2026 14:03

@jrfnl jrfnl 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.

@janedbal Thanks for this PR. Interesting proposal and nice performance gain.

Before I look at the code in detail, I'd like to ask you a couple of questions:

  1. Will this change the file order for the Full report ?
    I.e. if 20 files have issues, they are currently scanned by alphabetic file system order IIRC and the file reports will be ordered by this alphabetic file system order I believe. Will this order change with this PR ?
  2. Can you think of a way that this change could be safeguarded via tests ?
    This doesn't necessarily need to be unit tests, we also have a BashUnit test setup and a phpt test setup if that would help to allow for safeguarding the change via tests.
  3. Can you think of a way that the performance improvement could be safeguarded via CI ?
  4. Can you guarantee that no AI was used to create this PR ?

@janedbal

Copy link
Copy Markdown
Author

@jrfnl

  1. sequential mode is untouched, in parallel mode the order was already non-deterministic before this PR
  2. maybe, but likely not easily
  3. this is super hard everywhere, timing assertions in CI are flaky by nature
  4. original complex MR was AI one (Use work-stealing scheduler for parallel runs #1419), this one is simple and is human one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants