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

POC: Allow to limit the max-depth of Exporter->export() #55

Closed
wants to merge 1 commit into from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Mar 28, 2024

implements the idea described in sebastianbergmann/phpunit#5758 (comment)

running the roave/BetterReflection test-suite with phpunit 11.0.8:

mstaab@NB-COMPLEX-61 MINGW64 /c/dvl/Workspace/BetterReflectionPhpStan (6.33.x)
$ vendor/bin/phpunit
PHPUnit 11.0.8 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.12
Configuration: C:\dvl\Workspace\BetterReflectionPhpStan\phpunit.xml.dist
Random Seed:   1711622776

...........................................................    59 / 10383 (  0%)
...........................................................   118 / 10383 (  1%)
...........................................................   177 / 10383 (  1%)
...........................................................   236 / 10383 (  2%)
...........................................................   295 / 10383 (  2%)
...........................................................   354 / 10383 (  3%)
...........................................................   413 / 10383 (  3%)
...........................................................   472 / 10383 (  4%)
...........................................................   531 / 10383 (  5%)
...........................................................   590 / 10383 (  5%)
...........................................................   649 / 10383 (  6%)
...........................................................   708 / 10383 (  6%)
.............................S.............................   767 / 10383 (  7%)
...........................................................   826 / 10383 (  7%)
...........................................................   885 / 10383 (  8%)
...........................................................   944 / 10383 (  9%)
...........................................................  1003 / 10383 (  9%)
...........................................................  1062 / 10383 ( 10%)
...........................................................  1121 / 10383 ( 10%)
...........................................................  1180 / 10383 ( 11%)
...........................................................  1239 / 10383 ( 11%)
...........................................................  1298 / 10383 ( 12%)
...........................................................  1357 / 10383 ( 13%)
...........................................................  1416 / 10383 ( 13%)
...........................................................  1475 / 10383 ( 14%)
...........................................................  1534 / 10383 ( 14%)
...........................................................  1593 / 10383 ( 15%)
...........................................................  1652 / 10383 ( 15%)
...........................................................  1711 / 10383 ( 16%)
...........................................................  1770 / 10383 ( 17%)
...........................................................  1829 / 10383 ( 17%)
...........................................................  1888 / 10383 ( 18%)
...........................................................  1947 / 10383 ( 18%)
...........................................................  2006 / 10383 ( 19%)
...........................................................  2065 / 10383 ( 19%)
...........................................................  2124 / 10383 ( 20%)
...........................................................  2183 / 10383 ( 21%)
...........................................................  2242 / 10383 ( 21%)
...........................................................  2301 / 10383 ( 22%)
...........................................................  2360 / 10383 ( 22%)
...........................................................  2419 / 10383 ( 23%)
...........................................................  2478 / 10383 ( 23%)
...........................................................  2537 / 10383 ( 24%)
...........................................................  2596 / 10383 ( 25%)
...........................................................  2655 / 10383 ( 25%)
...........................................................  2714 / 10383 ( 26%)
...........................................................  2773 / 10383 ( 26%)
...........................................................  2832 / 10383 ( 27%)
...........................................................  2891 / 10383 ( 27%)
...........................................................  2950 / 10383 ( 28%)
...........................................................  3009 / 10383 ( 28%)
....................SSSS.......................S...........  3068 / 10383 ( 29%)
...........................................................  3127 / 10383 ( 30%)
...........................................................  3186 / 10383 ( 30%)
...........................................................  3245 / 10383 ( 31%)
...........................................................  3304 / 10383 ( 31%)
...........................................................  3363 / 10383 ( 32%)
...........................................................  3422 / 10383 ( 32%)
...........................................................  3481 / 10383 ( 33%)
...........................................................  3540 / 10383 ( 34%)
...........................................................  3599 / 10383 ( 34%)
...........................................................  3658 / 10383 ( 35%)
...........................................................  3717 / 10383 ( 35%)
...........................................................  3776 / 10383 ( 36%)
...........................................................  3835 / 10383 ( 36%)
...........................................................  3894 / 10383 ( 37%)
...........................................................  3953 / 10383 ( 38%)
...........................................................  4012 / 10383 ( 38%)
...........................................................  4071 / 10383 ( 39%)
...........................................................  4130 / 10383 ( 39%)
...........................................................  4189 / 10383 ( 40%)
...........................................................  4248 / 10383 ( 40%)
...........................................................  4307 / 10383 ( 41%)
...........................................................  4366 / 10383 ( 42%)
...........................................................  4425 / 10383 ( 42%)
...........................................................  4484 / 10383 ( 43%)
...........................................................  4543 / 10383 ( 43%)
...........................................................  4602 / 10383 ( 44%)
...........................................................  4661 / 10383 ( 44%)
...........................................................  4720 / 10383 ( 45%)
...........................................................  4779 / 10383 ( 46%)
...........................................................  4838 / 10383 ( 46%)
...........................................................  4897 / 10383 ( 47%)
...........................................................  4956 / 10383 ( 47%)
...........................................................  5015 / 10383 ( 48%)
...........................................................  5074 / 10383 ( 48%)
...........................................................  5133 / 10383 ( 49%)
...........................................................  5192 / 10383 ( 50%)
...........................................................  5251 / 10383 ( 50%)
...........................................................  5310 / 10383 ( 51%)
...........................................................  5369 / 10383 ( 51%)
...........................................................  5428 / 10383 ( 52%)
...........................................................  5487 / 10383 ( 52%)
...........................................................  5546 / 10383 ( 53%)
...........................................................  5605 / 10383 ( 53%)
...........................................................  5664 / 10383 ( 54%)
...........................................................  5723 / 10383 ( 55%)
...........................................................  5782 / 10383 ( 55%)
...........................................................  5841 / 10383 ( 56%)
...........................................................  5900 / 10383 ( 56%)
...........................................................  5959 / 10383 ( 57%)
...........................................................  6018 / 10383 ( 57%)
...........................................................  6077 / 10383 ( 58%)
...........................................................  6136 / 10383 ( 59%)
...........................................................  6195 / 10383 ( 59%)
...........................................................  6254 / 10383 ( 60%)
...........................................................  6313 / 10383 ( 60%)
...........................................................  6372 / 10383 ( 61%)
...........................................................  6431 / 10383 ( 61%)
...........................................................  6490 / 10383 ( 62%)
...........................................................  6549 / 10383 ( 63%)
...........................................................  6608 / 10383 ( 63%)
...........................................................  6667 / 10383 ( 64%)
...........................................................  6726 / 10383 ( 64%)
...........................................................  6785 / 10383 ( 65%)
...........................................................  6844 / 10383 ( 65%)
...........................................................  6903 / 10383 ( 66%)
...........................................................  6962 / 10383 ( 67%)
...........................................................  7021 / 10383 ( 67%)
...........................................................  7080 / 10383 ( 68%)
...........................................................  7139 / 10383 ( 68%)
...........................................................  7198 / 10383 ( 69%)
...........................................................  7257 / 10383 ( 69%)
...........................................................  7316 / 10383 ( 70%)
...........................................................  7375 / 10383 ( 71%)
...........................................................  7434 / 10383 ( 71%)
...........................................................  7493 / 10383 ( 72%)
...........................................................  7552 / 10383 ( 72%)
...........................................................  7611 / 10383 ( 73%)
...........................................................  7670 / 10383 ( 73%)
...........................................................  7729 / 10383 ( 74%)
...........................................................  7788 / 10383 ( 75%)
...........................................................  7847 / 10383 ( 75%)
...........................................................  7906 / 10383 ( 76%)
...........................................................  7965 / 10383 ( 76%)
..........................................................S  8024 / 10383 ( 77%)
...........................................................  8083 / 10383 ( 77%)
...........................................................  8142 / 10383 ( 78%)
...........................................................  8201 / 10383 ( 78%)
...........................................................  8260 / 10383 ( 79%)
...........................................................  8319 / 10383 ( 80%)
...........................................................  8378 / 10383 ( 80%)
...........................................................  8437 / 10383 ( 81%)
...........................................................  8496 / 10383 ( 81%)
...........................................................  8555 / 10383 ( 82%)
...........................................................  8614 / 10383 ( 82%)
...........................................................  8673 / 10383 ( 83%)
...........................................................  8732 / 10383 ( 84%)
...........................................................  8791 / 10383 ( 84%)
...........................................................  8850 / 10383 ( 85%)
...........................................................  8909 / 10383 ( 85%)
...........................................................  8968 / 10383 ( 86%)
...........................................................  9027 / 10383 ( 86%)
...........................................................  9086 / 10383 ( 87%)
...........................................................  9145 / 10383 ( 88%)
...........................................................  9204 / 10383 ( 88%)
...........................................................  9263 / 10383 ( 89%)
...........................................................  9322 / 10383 ( 89%)
...........................................................  9381 / 10383 ( 90%)
...........................................................  9440 / 10383 ( 90%)
...........................................................  9499 / 10383 ( 91%)
...........................................................  9558 / 10383 ( 92%)
...........................................................  9617 / 10383 ( 92%)
...........................................................  9676 / 10383 ( 93%)
...........................................................  9735 / 10383 ( 93%)
...........................................................  9794 / 10383 ( 94%)
...........................................................  9853 / 10383 ( 94%)
...........................................................  9912 / 10383 ( 95%)
...........................................................  9971 / 10383 ( 96%)
........................................................... 10030 / 10383 ( 96%)
........................................................... 10089 / 10383 ( 97%)
........................................................... 10148 / 10383 ( 97%)
........................................................... 10207 / 10383 ( 98%)
........................................................... 10266 / 10383 ( 98%)
........................................................... 10325 / 10383 ( 99%)
..........................................................  10383 / 10383 (100%)

Time: 01:07.407, Memory: 3.76 GB

OK, but some tests were skipped!
Tests: 10383, Assertions: 65007, Skipped: 7.

runnig with a max-level of 6:

$ vendor/bin/phpunit
PHPUnit 11.0.8 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.12
Configuration: C:\dvl\Workspace\BetterReflectionPhpStan\phpunit.xml.dist
Random Seed:   1711622869

...........................................................    59 / 10383 (  0%)
...........................................................   118 / 10383 (  1%)
...........................................................   177 / 10383 (  1%)
...........................................................   236 / 10383 (  2%)
.........................................................S.   295 / 10383 (  2%)
...........................................................   354 / 10383 (  3%)
.........S.................................................   413 / 10383 (  3%)
...........................................................   472 / 10383 (  4%)
...........................................................   531 / 10383 (  5%)
...........................................................   590 / 10383 (  5%)
...........................................................   649 / 10383 (  6%)
...........................................................   708 / 10383 (  6%)
...........................................................   767 / 10383 (  7%)
...........................................................   826 / 10383 (  7%)
...........................................................   885 / 10383 (  8%)
...........................................................   944 / 10383 (  9%)
...........................................................  1003 / 10383 (  9%)
...........................................................  1062 / 10383 ( 10%)
...........................................................  1121 / 10383 ( 10%)
...........................................................  1180 / 10383 ( 11%)
...........................................................  1239 / 10383 ( 11%)
...........................................................  1298 / 10383 ( 12%)
...........................................................  1357 / 10383 ( 13%)
...........................................................  1416 / 10383 ( 13%)
...........................................................  1475 / 10383 ( 14%)
...........................................................  1534 / 10383 ( 14%)
...........................................................  1593 / 10383 ( 15%)
...........................................................  1652 / 10383 ( 15%)
...........................................................  1711 / 10383 ( 16%)
...........................................................  1770 / 10383 ( 17%)
...........................................................  1829 / 10383 ( 17%)
...........................................................  1888 / 10383 ( 18%)
...................S.......................................  1947 / 10383 ( 18%)
...........................................................  2006 / 10383 ( 19%)
...........................................................  2065 / 10383 ( 19%)
...........................................................  2124 / 10383 ( 20%)
...........................................................  2183 / 10383 ( 21%)
...........................................................  2242 / 10383 ( 21%)
...........................................................  2301 / 10383 ( 22%)
...........................................................  2360 / 10383 ( 22%)
...........................................................  2419 / 10383 ( 23%)
...........................................................  2478 / 10383 ( 23%)
...........................................................  2537 / 10383 ( 24%)
...........................................................  2596 / 10383 ( 25%)
...........................................................  2655 / 10383 ( 25%)
...........................................................  2714 / 10383 ( 26%)
...........................................................  2773 / 10383 ( 26%)
...........................................................  2832 / 10383 ( 27%)
...........................................................  2891 / 10383 ( 27%)
...........................................................  2950 / 10383 ( 28%)
...........................................................  3009 / 10383 ( 28%)
...........................................................  3068 / 10383 ( 29%)
...........................................................  3127 / 10383 ( 30%)
...........................................................  3186 / 10383 ( 30%)
...........................................................  3245 / 10383 ( 31%)
...........................................................  3304 / 10383 ( 31%)
...........................................................  3363 / 10383 ( 32%)
...........................................................  3422 / 10383 ( 32%)
...........................................................  3481 / 10383 ( 33%)
...........................................................  3540 / 10383 ( 34%)
...........................................................  3599 / 10383 ( 34%)
...........................................................  3658 / 10383 ( 35%)
...........................................................  3717 / 10383 ( 35%)
...........................................................  3776 / 10383 ( 36%)
...........................................................  3835 / 10383 ( 36%)
...........................................................  3894 / 10383 ( 37%)
...........................................................  3953 / 10383 ( 38%)
...........................................................  4012 / 10383 ( 38%)
...........................................................  4071 / 10383 ( 39%)
...........................................................  4130 / 10383 ( 39%)
...........................................................  4189 / 10383 ( 40%)
...........................................................  4248 / 10383 ( 40%)
...........................................................  4307 / 10383 ( 41%)
...........................................................  4366 / 10383 ( 42%)
...........................................................  4425 / 10383 ( 42%)
...........................................................  4484 / 10383 ( 43%)
...........................................................  4543 / 10383 ( 43%)
...........................................................  4602 / 10383 ( 44%)
...........................................................  4661 / 10383 ( 44%)
...........................................................  4720 / 10383 ( 45%)
...........................................................  4779 / 10383 ( 46%)
...........................................................  4838 / 10383 ( 46%)
...........................................................  4897 / 10383 ( 47%)
...........................................................  4956 / 10383 ( 47%)
...........................................................  5015 / 10383 ( 48%)
...........................................................  5074 / 10383 ( 48%)
...........................................................  5133 / 10383 ( 49%)
...........................................................  5192 / 10383 ( 50%)
...........................................................  5251 / 10383 ( 50%)
...........................................................  5310 / 10383 ( 51%)
...........................................................  5369 / 10383 ( 51%)
...........................................................  5428 / 10383 ( 52%)
...........................................................  5487 / 10383 ( 52%)
...........................................................  5546 / 10383 ( 53%)
...........................................................  5605 / 10383 ( 53%)
...........................................................  5664 / 10383 ( 54%)
...........................................................  5723 / 10383 ( 55%)
...........................................................  5782 / 10383 ( 55%)
...........................................................  5841 / 10383 ( 56%)
...........................................................  5900 / 10383 ( 56%)
...........................................................  5959 / 10383 ( 57%)
...........................................................  6018 / 10383 ( 57%)
...........................................................  6077 / 10383 ( 58%)
...........................................................  6136 / 10383 ( 59%)
...........................................................  6195 / 10383 ( 59%)
...........................................................  6254 / 10383 ( 60%)
...........................................................  6313 / 10383 ( 60%)
...........................................................  6372 / 10383 ( 61%)
...........................................................  6431 / 10383 ( 61%)
...........................................................  6490 / 10383 ( 62%)
...........................................................  6549 / 10383 ( 63%)
...........................................................  6608 / 10383 ( 63%)
...........................................................  6667 / 10383 ( 64%)
...........................................................  6726 / 10383 ( 64%)
...........................................................  6785 / 10383 ( 65%)
...........................................................  6844 / 10383 ( 65%)
...........................................................  6903 / 10383 ( 66%)
...........................................................  6962 / 10383 ( 67%)
...........................................................  7021 / 10383 ( 67%)
...........................................................  7080 / 10383 ( 68%)
...........................................................  7139 / 10383 ( 68%)
...........................................................  7198 / 10383 ( 69%)
...........................................................  7257 / 10383 ( 69%)
...........................................................  7316 / 10383 ( 70%)
...........................................................  7375 / 10383 ( 71%)
...........................................................  7434 / 10383 ( 71%)
...........................................................  7493 / 10383 ( 72%)
...........................................................  7552 / 10383 ( 72%)
...........................................................  7611 / 10383 ( 73%)
...........................................................  7670 / 10383 ( 73%)
...........................................................  7729 / 10383 ( 74%)
...........................................................  7788 / 10383 ( 75%)
...........................................................  7847 / 10383 ( 75%)
...........................................................  7906 / 10383 ( 76%)
...........................................................  7965 / 10383 ( 76%)
...........................................................  8024 / 10383 ( 77%)
...........................................................  8083 / 10383 ( 77%)
...........................................................  8142 / 10383 ( 78%)
...........................................................  8201 / 10383 ( 78%)
...........................................................  8260 / 10383 ( 79%)
...........................................................  8319 / 10383 ( 80%)
...........................................................  8378 / 10383 ( 80%)
...........................................................  8437 / 10383 ( 81%)
...........................................................  8496 / 10383 ( 81%)
...........................................................  8555 / 10383 ( 82%)
...........................................................  8614 / 10383 ( 82%)
...........................................................  8673 / 10383 ( 83%)
...........................................................  8732 / 10383 ( 84%)
...........................................................  8791 / 10383 ( 84%)
...........................................................  8850 / 10383 ( 85%)
...........................................................  8909 / 10383 ( 85%)
...........................................................  8968 / 10383 ( 86%)
.........SSSS..............................................  9027 / 10383 ( 86%)
...........................................................  9086 / 10383 ( 87%)
...........................................................  9145 / 10383 ( 88%)
...........................................................  9204 / 10383 ( 88%)
...........................................................  9263 / 10383 ( 89%)
...........................................................  9322 / 10383 ( 89%)
...........................................................  9381 / 10383 ( 90%)
...........................................................  9440 / 10383 ( 90%)
...........................................................  9499 / 10383 ( 91%)
...........................................................  9558 / 10383 ( 92%)
...........................................................  9617 / 10383 ( 92%)
...........................................................  9676 / 10383 ( 93%)
...........................................................  9735 / 10383 ( 93%)
...........................................................  9794 / 10383 ( 94%)
...........................................................  9853 / 10383 ( 94%)
...........................................................  9912 / 10383 ( 95%)
...........................................................  9971 / 10383 ( 96%)
........................................................... 10030 / 10383 ( 96%)
........................................................... 10089 / 10383 ( 97%)
........................................................... 10148 / 10383 ( 97%)
........................................................... 10207 / 10383 ( 98%)
........................................................... 10266 / 10383 ( 98%)
........................................................... 10325 / 10383 ( 99%)
..........................................................  10383 / 10383 (100%)

Time: 00:19.986, Memory: 1.06 GB

OK, but some tests were skipped!
Tests: 10383, Assertions: 65007, Skipped: 7.

just as an idea/alternative to whatever you build on the POC you are looking into

I am fine with leaving this undiscussed and wait for your POC

Copy link

codecov bot commented Mar 28, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 98.70%. Comparing base (e58279a) to head (464d680).

Files Patch % Lines
src/Exporter.php 77.77% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##                main      #55      +/-   ##
=============================================
- Coverage     100.00%   98.70%   -1.30%     
- Complexity        45       47       +2     
=============================================
  Files              1        1              
  Lines            151      155       +4     
=============================================
+ Hits             151      153       +2     
- Misses             0        2       +2     

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

@staabm
Copy link
Contributor Author

staabm commented Mar 28, 2024

this PR is based on the idea that the resource consumption gets exponentially higher with the recursion level, see

grafik

@staabm
Copy link
Contributor Author

staabm commented Mar 29, 2024

I don't think we need this PR because there is something similar already - see sebastianbergmann/phpunit#5774

@staabm staabm closed this Mar 29, 2024
@staabm staabm deleted the recurion-lvl branch March 29, 2024 06:49
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.

2 participants