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

Use array_pop() instead of array_shift() for processing Test objects in TestSuite::run() and optimize TestSuite::isEmpty() #5877

Merged
merged 2 commits into from
Jun 20, 2024

Conversation

mvorisek
Copy link
Contributor

improve #5875 performance, array_shift is very slow with large arrays

@sebastianbergmann sebastianbergmann added feature/test-runner CLI test runner type/performance Issues related to resource consumption (time and memory) labels Jun 20, 2024
@mvorisek mvorisek force-pushed the improve_array_pop branch from 0d34397 to 1267e41 Compare June 20, 2024 08:17
@mvorisek mvorisek marked this pull request as ready for review June 20, 2024 08:21
@mvorisek mvorisek force-pushed the improve_array_pop branch from 1267e41 to 47449ae Compare June 20, 2024 08:23
Copy link

codecov bot commented Jun 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.16%. Comparing base (1282659) to head (47449ae).

Additional details and impacted files
@@            Coverage Diff            @@
##               10.5    #5877   +/-   ##
=========================================
  Coverage     92.15%   92.16%           
- Complexity     6358     6360    +2     
=========================================
  Files           677      677           
  Lines         19270    19274    +4     
=========================================
+ Hits          17759    17763    +4     
  Misses         1511     1511           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sebastianbergmann
Copy link
Owner

improve #5875 performance, array_shift is very slow with large arrays

Can you share a benchmark? Thanks!

@mvorisek
Copy link
Contributor Author

https://3v4l.org/4vGK2/rfc#vgit.master_jit - with even more items the performance difference is even much higher - one has O(N) complexity as the array is always reallocated, the other one has O(1)

@sebastianbergmann sebastianbergmann changed the title Optimize TestSuite run with many providers Use array_pop() instead of array_shift() for processing Test objects in TestSuite::run() Jun 20, 2024
@sebastianbergmann sebastianbergmann changed the title Use array_pop() instead of array_shift() for processing Test objects in TestSuite::run() Use array_pop() instead of array_shift() for processing Test objects in TestSuite::run() and optimize TestSuite::empty() Jun 20, 2024
@sebastianbergmann sebastianbergmann changed the title Use array_pop() instead of array_shift() for processing Test objects in TestSuite::run() and optimize TestSuite::empty() Use array_pop() instead of array_shift() for processing Test objects in TestSuite::run() and optimize TestSuite::isEmpty() Jun 20, 2024
@sebastianbergmann sebastianbergmann merged commit 3a664ca into sebastianbergmann:10.5 Jun 20, 2024
31 checks passed
@sebastianbergmann
Copy link
Owner

Thank you!

@mvorisek mvorisek deleted the improve_array_pop branch June 20, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner type/performance Issues related to resource consumption (time and memory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants