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 static function, inline call #364

Merged
merged 10 commits into from
Jun 16, 2024
Merged

Use static function, inline call #364

merged 10 commits into from
Jun 16, 2024

Conversation

samdark
Copy link
Member

@samdark samdark commented Jun 15, 2024

Q A
Is bugfix?
New feature?
Breaks BC?
Fixed issues -

@samdark
Copy link
Member Author

samdark commented Jun 15, 2024

Before:

+------+-------------------------+-----------------------------+-----+------+-------------+-------------+--------------+----------------+
| iter | benchmark               | subject                     | set | revs | mem_peak    | time_avg    | comp_z_value | comp_deviation |
+------+-------------------------+-----------------------------+-----+------+-------------+-------------+--------------+----------------+
| 0    | ContainerBench          | benchConstruct              |     | 1000 | 27,042,480b | 368.005μs   | -0.80σ       | -1.22%         |
| 1    | ContainerBench          | benchConstruct              |     | 1000 | 27,042,480b | 367.810μs   | -0.84σ       | -1.28%         |
| 2    | ContainerBench          | benchConstruct              |     | 1000 | 27,042,480b | 370.206μs   | -0.42σ       | -0.63%         |
| 3    | ContainerBench          | benchConstruct              |     | 1000 | 27,042,480b | 383.077μs   | +1.85σ       | +2.82%         |
| 4    | ContainerBench          | benchConstruct              |     | 1000 | 27,042,480b | 373.738μs   | +0.21σ       | +0.31%         |
| 0    | ContainerBench          | benchSequentialLookups      | 0   | 1000 | 39,042,672b | 731.166μs   | -1.93σ       | -2.12%         |
| 1    | ContainerBench          | benchSequentialLookups      | 0   | 1000 | 39,042,672b | 755.112μs   | +0.98σ       | +1.08%         |
| 2    | ContainerBench          | benchSequentialLookups      | 0   | 1000 | 39,042,672b | 749.724μs   | +0.33σ       | +0.36%         |
| 3    | ContainerBench          | benchSequentialLookups      | 0   | 1000 | 39,042,672b | 748.986μs   | +0.24σ       | +0.26%         |
| 4    | ContainerBench          | benchSequentialLookups      | 0   | 1000 | 39,042,672b | 750.180μs   | +0.38σ       | +0.42%         |
| 0    | ContainerBench          | benchSequentialLookups      | 1   | 1000 | 39,207,248b | 773.143μs   | -0.82σ       | -1.31%         |
| 1    | ContainerBench          | benchSequentialLookups      | 1   | 1000 | 39,207,248b | 788.938μs   | +0.45σ       | +0.71%         |
| 2    | ContainerBench          | benchSequentialLookups      | 1   | 1000 | 39,207,248b | 772.115μs   | -0.90σ       | -1.44%         |
| 3    | ContainerBench          | benchSequentialLookups      | 1   | 1000 | 39,207,248b | 777.364μs   | -0.48σ       | -0.77%         |
| 4    | ContainerBench          | benchSequentialLookups      | 1   | 1000 | 39,207,248b | 805.315μs   | +1.76σ       | +2.80%         |
| 0    | ContainerBench          | benchSequentialLookups      | 2   | 1000 | 39,206,968b | 784.482μs   | -0.11σ       | -0.17%         |
| 1    | ContainerBench          | benchSequentialLookups      | 2   | 1000 | 39,206,968b | 777.825μs   | -0.64σ       | -1.02%         |
| 2    | ContainerBench          | benchSequentialLookups      | 2   | 1000 | 39,206,968b | 771.634μs   | -1.14σ       | -1.81%         |
| 3    | ContainerBench          | benchSequentialLookups      | 2   | 1000 | 39,206,968b | 786.878μs   | +0.08σ       | +0.13%         |
| 4    | ContainerBench          | benchSequentialLookups      | 2   | 1000 | 39,206,968b | 808.348μs   | +1.81σ       | +2.87%         |
| 0    | ContainerBench          | benchRandomLookups          | 0   | 1000 | 39,042,672b | 740.180μs   | -0.97σ       | -1.76%         |
| 1    | ContainerBench          | benchRandomLookups          | 0   | 1000 | 39,042,672b | 772.406μs   | +1.39σ       | +2.52%         |
| 2    | ContainerBench          | benchRandomLookups          | 0   | 1000 | 39,042,672b | 760.158μs   | +0.49σ       | +0.89%         |
| 3    | ContainerBench          | benchRandomLookups          | 0   | 1000 | 39,042,672b | 735.636μs   | -1.31σ       | -2.36%         |
| 4    | ContainerBench          | benchRandomLookups          | 0   | 1000 | 39,042,672b | 758.819μs   | +0.40σ       | +0.71%         |
| 0    | ContainerBench          | benchRandomLookups          | 1   | 1000 | 39,207,248b | 806.514μs   | +1.89σ       | +2.71%         |
| 1    | ContainerBench          | benchRandomLookups          | 1   | 1000 | 39,207,248b | 774.862μs   | -0.92σ       | -1.32%         |
| 2    | ContainerBench          | benchRandomLookups          | 1   | 1000 | 39,207,248b | 785.374μs   | +0.01σ       | +0.02%         |
| 3    | ContainerBench          | benchRandomLookups          | 1   | 1000 | 39,207,248b | 782.542μs   | -0.24σ       | -0.35%         |
| 4    | ContainerBench          | benchRandomLookups          | 1   | 1000 | 39,207,248b | 776.978μs   | -0.73σ       | -1.05%         |
| 0    | ContainerBench          | benchRandomLookups          | 2   | 1000 | 39,206,968b | 781.610μs   | -0.35σ       | -0.26%         |
| 1    | ContainerBench          | benchRandomLookups          | 2   | 1000 | 39,206,968b | 776.157μs   | -1.26σ       | -0.96%         |
| 2    | ContainerBench          | benchRandomLookups          | 2   | 1000 | 39,206,968b | 788.666μs   | +0.84σ       | +0.64%         |
| 3    | ContainerBench          | benchRandomLookups          | 2   | 1000 | 39,206,968b | 792.270μs   | +1.45σ       | +1.10%         |
| 4    | ContainerBench          | benchRandomLookups          | 2   | 1000 | 39,206,968b | 779.608μs   | -0.68σ       | -0.52%         |
| 0    | ContainerBench          | benchRandomLookupsComposite | 0   | 1000 | 27,148,232b | 2,208.161μs | -0.94σ       | -1.21%         |
| 1    | ContainerBench          | benchRandomLookupsComposite | 0   | 1000 | 27,148,232b | 2,236.624μs | +0.05σ       | +0.06%         |
| 2    | ContainerBench          | benchRandomLookupsComposite | 0   | 1000 | 27,148,232b | 2,235.382μs | +0.01σ       | +0.01%         |
| 3    | ContainerBench          | benchRandomLookupsComposite | 0   | 1000 | 27,148,232b | 2,287.460μs | +1.81σ       | +2.34%         |
| 4    | ContainerBench          | benchRandomLookupsComposite | 0   | 1000 | 27,148,232b | 2,208.425μs | -0.93σ       | -1.20%         |
| 0    | ContainerBench          | benchRandomLookupsComposite | 1   | 1000 | 27,177,064b | 2,254.359μs | +0.85σ       | +0.71%         |
| 1    | ContainerBench          | benchRandomLookupsComposite | 1   | 1000 | 27,177,064b | 2,218.899μs | -1.05σ       | -0.88%         |
| 2    | ContainerBench          | benchRandomLookupsComposite | 1   | 1000 | 27,177,064b | 2,221.624μs | -0.90σ       | -0.75%         |
| 3    | ContainerBench          | benchRandomLookupsComposite | 1   | 1000 | 27,177,064b | 2,231.336μs | -0.38σ       | -0.32%         |
| 4    | ContainerBench          | benchRandomLookupsComposite | 1   | 1000 | 27,177,064b | 2,266.369μs | +1.49σ       | +1.24%         |
| 0    | ContainerBench          | benchRandomLookupsComposite | 2   | 1000 | 27,176,784b | 2,237.949μs | +0.43σ       | +0.35%         |
| 1    | ContainerBench          | benchRandomLookupsComposite | 2   | 1000 | 27,176,784b | 2,212.973μs | -0.96σ       | -0.77%         |
| 2    | ContainerBench          | benchRandomLookupsComposite | 2   | 1000 | 27,176,784b | 2,206.247μs | -1.33σ       | -1.08%         |
| 3    | ContainerBench          | benchRandomLookupsComposite | 2   | 1000 | 27,176,784b | 2,255.299μs | +1.39σ       | +1.12%         |
| 4    | ContainerBench          | benchRandomLookupsComposite | 2   | 1000 | 27,176,784b | 2,238.790μs | +0.47σ       | +0.38%         |
| 0    | ContainerMethodHasBench | benchPredefinedExisting     |     | 1000 | 5,681,592b  | 126.325μs   | -1.57σ       | -0.95%         |
| 1    | ContainerMethodHasBench | benchPredefinedExisting     |     | 1000 | 5,681,592b  | 127.612μs   | +0.09σ       | +0.05%         |
| 2    | ContainerMethodHasBench | benchPredefinedExisting     |     | 1000 | 5,681,592b  | 127.896μs   | +0.46σ       | +0.28%         |
| 3    | ContainerMethodHasBench | benchPredefinedExisting     |     | 1000 | 5,681,592b  | 128.667μs   | +1.46σ       | +0.88%         |
| 4    | ContainerMethodHasBench | benchPredefinedExisting     |     | 1000 | 5,681,592b  | 127.211μs   | -0.43σ       | -0.26%         |
| 0    | ContainerMethodHasBench | benchUndefinedExisting      |     | 1000 | 5,681,592b  | 118.764μs   | -0.15σ       | -0.10%         |
| 1    | ContainerMethodHasBench | benchUndefinedExisting      |     | 1000 | 5,681,592b  | 119.627μs   | +0.94σ       | +0.63%         |
| 2    | ContainerMethodHasBench | benchUndefinedExisting      |     | 1000 | 5,681,592b  | 117.894μs   | -1.25σ       | -0.83%         |
| 3    | ContainerMethodHasBench | benchUndefinedExisting      |     | 1000 | 5,681,592b  | 119.935μs   | +1.33σ       | +0.89%         |
| 4    | ContainerMethodHasBench | benchUndefinedExisting      |     | 1000 | 5,681,592b  | 118.191μs   | -0.87σ       | -0.58%         |
| 0    | ContainerMethodHasBench | benchUndefinedNonexistent   |     | 1000 | 5,681,608b  | 418.171μs   | -1.06σ       | -0.82%         |
| 1    | ContainerMethodHasBench | benchUndefinedNonexistent   |     | 1000 | 5,681,608b  | 417.626μs   | -1.23σ       | -0.95%         |
| 2    | ContainerMethodHasBench | benchUndefinedNonexistent   |     | 1000 | 5,681,608b  | 425.935μs   | +1.33σ       | +1.03%         |
| 3    | ContainerMethodHasBench | benchUndefinedNonexistent   |     | 1000 | 5,681,608b  | 423.993μs   | +0.73σ       | +0.56%         |
| 4    | ContainerMethodHasBench | benchUndefinedNonexistent   |     | 1000 | 5,681,608b  | 422.338μs   | +0.22σ       | +0.17%         |
+------+-------------------------+-----------------------------+-----+------+-------------+-------------+--------------+----------------+

After:

+------+-------------------------+-----------------------------+-----+------+-------------+-------------+--------------+----------------+
| iter | benchmark               | subject                     | set | revs | mem_peak    | time_avg    | comp_z_value | comp_deviation |
+------+-------------------------+-----------------------------+-----+------+-------------+-------------+--------------+----------------+
| 0    | ContainerBench          | benchConstruct              |     | 1000 | 27,041,000b | 321.932μs   | -0.38σ       | -0.33%         |
| 1    | ContainerBench          | benchConstruct              |     | 1000 | 27,041,000b | 325.841μs   | +1.02σ       | +0.88%         |
| 2    | ContainerBench          | benchConstruct              |     | 1000 | 27,041,000b | 325.006μs   | +0.72σ       | +0.62%         |
| 3    | ContainerBench          | benchConstruct              |     | 1000 | 27,041,000b | 324.142μs   | +0.41σ       | +0.36%         |
| 4    | ContainerBench          | benchConstruct              |     | 1000 | 27,041,000b | 318.017μs   | -1.77σ       | -1.54%         |
| 0    | ContainerBench          | benchSequentialLookups      | 0   | 1000 | 39,041,192b | 652.878μs   | -0.30σ       | -0.22%         |
| 1    | ContainerBench          | benchSequentialLookups      | 0   | 1000 | 39,041,192b | 650.478μs   | -0.82σ       | -0.58%         |
| 2    | ContainerBench          | benchSequentialLookups      | 0   | 1000 | 39,041,192b | 663.258μs   | +1.93σ       | +1.37%         |
| 3    | ContainerBench          | benchSequentialLookups      | 0   | 1000 | 39,041,192b | 653.901μs   | -0.08σ       | -0.06%         |
| 4    | ContainerBench          | benchSequentialLookups      | 0   | 1000 | 39,041,192b | 650.918μs   | -0.72σ       | -0.51%         |
| 0    | ContainerBench          | benchSequentialLookups      | 1   | 1000 | 39,205,768b | 680.714μs   | -1.31σ       | -0.69%         |
| 1    | ContainerBench          | benchSequentialLookups      | 1   | 1000 | 39,205,768b | 691.338μs   | +1.61σ       | +0.86%         |
| 2    | ContainerBench          | benchSequentialLookups      | 1   | 1000 | 39,205,768b | 683.794μs   | -0.46σ       | -0.24%         |
| 3    | ContainerBench          | benchSequentialLookups      | 1   | 1000 | 39,205,768b | 684.008μs   | -0.40σ       | -0.21%         |
| 4    | ContainerBench          | benchSequentialLookups      | 1   | 1000 | 39,205,768b | 687.506μs   | +0.56σ       | +0.30%         |
| 0    | ContainerBench          | benchSequentialLookups      | 2   | 1000 | 39,205,488b | 687.203μs   | +1.04σ       | +0.35%         |
| 1    | ContainerBench          | benchSequentialLookups      | 2   | 1000 | 39,205,488b | 686.215μs   | +0.61σ       | +0.20%         |
| 2    | ContainerBench          | benchSequentialLookups      | 2   | 1000 | 39,205,488b | 680.742μs   | -1.80σ       | -0.60%         |
| 3    | ContainerBench          | benchSequentialLookups      | 2   | 1000 | 39,205,488b | 685.882μs   | +0.46σ       | +0.15%         |
| 4    | ContainerBench          | benchSequentialLookups      | 2   | 1000 | 39,205,488b | 684.098μs   | -0.32σ       | -0.11%         |
| 0    | ContainerBench          | benchRandomLookups          | 0   | 1000 | 39,041,192b | 656.919μs   | +0.11σ       | +0.09%         |
| 1    | ContainerBench          | benchRandomLookups          | 0   | 1000 | 39,041,192b | 665.729μs   | +1.88σ       | +1.43%         |
| 2    | ContainerBench          | benchRandomLookups          | 0   | 1000 | 39,041,192b | 654.410μs   | -0.39σ       | -0.30%         |
| 3    | ContainerBench          | benchRandomLookups          | 0   | 1000 | 39,041,192b | 652.281μs   | -0.82σ       | -0.62%         |
| 4    | ContainerBench          | benchRandomLookups          | 0   | 1000 | 39,041,192b | 652.403μs   | -0.79σ       | -0.60%         |
| 0    | ContainerBench          | benchRandomLookups          | 1   | 1000 | 39,205,768b | 680.896μs   | -1.07σ       | -0.53%         |
| 1    | ContainerBench          | benchRandomLookups          | 1   | 1000 | 39,205,768b | 687.395μs   | +0.85σ       | +0.42%         |
| 2    | ContainerBench          | benchRandomLookups          | 1   | 1000 | 39,205,768b | 680.962μs   | -1.05σ       | -0.52%         |
| 3    | ContainerBench          | benchRandomLookups          | 1   | 1000 | 39,205,768b | 684.015μs   | -0.15σ       | -0.07%         |
| 4    | ContainerBench          | benchRandomLookups          | 1   | 1000 | 39,205,768b | 689.334μs   | +1.42σ       | +0.70%         |
| 0    | ContainerBench          | benchRandomLookups          | 2   | 1000 | 39,205,488b | 694.791μs   | +0.37σ       | +0.43%         |
| 1    | ContainerBench          | benchRandomLookups          | 2   | 1000 | 39,205,488b | 685.770μs   | -0.75σ       | -0.87%         |
| 2    | ContainerBench          | benchRandomLookups          | 2   | 1000 | 39,205,488b | 685.639μs   | -0.77σ       | -0.89%         |
| 3    | ContainerBench          | benchRandomLookups          | 2   | 1000 | 39,205,488b | 686.458μs   | -0.66σ       | -0.77%         |
| 4    | ContainerBench          | benchRandomLookups          | 2   | 1000 | 39,205,488b | 706.341μs   | +1.81σ       | +2.10%         |
| 0    | ContainerBench          | benchRandomLookupsComposite | 0   | 1000 | 27,146,752b | 2,123.508μs | -0.90σ       | -1.38%         |
| 1    | ContainerBench          | benchRandomLookupsComposite | 0   | 1000 | 27,146,752b | 2,168.455μs | +0.46σ       | +0.71%         |
| 2    | ContainerBench          | benchRandomLookupsComposite | 0   | 1000 | 27,146,752b | 2,126.696μs | -0.80σ       | -1.23%         |
| 3    | ContainerBench          | benchRandomLookupsComposite | 0   | 1000 | 27,146,752b | 2,136.354μs | -0.51σ       | -0.79%         |
| 4    | ContainerBench          | benchRandomLookupsComposite | 0   | 1000 | 27,146,752b | 2,211.296μs | +1.75σ       | +2.70%         |
| 0    | ContainerBench          | benchRandomLookupsComposite | 1   | 1000 | 27,175,584b | 2,176.365μs | +1.68σ       | +1.61%         |
| 1    | ContainerBench          | benchRandomLookupsComposite | 1   | 1000 | 27,175,584b | 2,114.192μs | -1.34σ       | -1.29%         |
| 2    | ContainerBench          | benchRandomLookupsComposite | 1   | 1000 | 27,175,584b | 2,148.178μs | +0.31σ       | +0.30%         |
| 3    | ContainerBench          | benchRandomLookupsComposite | 1   | 1000 | 27,175,584b | 2,131.555μs | -0.50σ       | -0.48%         |
| 4    | ContainerBench          | benchRandomLookupsComposite | 1   | 1000 | 27,175,584b | 2,138.656μs | -0.15σ       | -0.15%         |
| 0    | ContainerBench          | benchRandomLookupsComposite | 2   | 1000 | 27,175,304b | 2,213.718μs | +1.69σ       | +2.77%         |
| 1    | ContainerBench          | benchRandomLookupsComposite | 2   | 1000 | 27,175,304b | 2,175.539μs | +0.61σ       | +0.99%         |
| 2    | ContainerBench          | benchRandomLookupsComposite | 2   | 1000 | 27,175,304b | 2,132.042μs | -0.63σ       | -1.03%         |
| 3    | ContainerBench          | benchRandomLookupsComposite | 2   | 1000 | 27,175,304b | 2,123.030μs | -0.88σ       | -1.44%         |
| 4    | ContainerBench          | benchRandomLookupsComposite | 2   | 1000 | 27,175,304b | 2,126.332μs | -0.79σ       | -1.29%         |
| 0    | ContainerMethodHasBench | benchPredefinedExisting     |     | 1000 | 5,681,280b  | 108.988μs   | -1.41σ       | -1.02%         |
| 1    | ContainerMethodHasBench | benchPredefinedExisting     |     | 1000 | 5,681,280b  | 111.077μs   | +1.20σ       | +0.87%         |
| 2    | ContainerMethodHasBench | benchPredefinedExisting     |     | 1000 | 5,681,280b  | 110.285μs   | +0.21σ       | +0.15%         |
| 3    | ContainerMethodHasBench | benchPredefinedExisting     |     | 1000 | 5,681,280b  | 110.808μs   | +0.87σ       | +0.63%         |
| 4    | ContainerMethodHasBench | benchPredefinedExisting     |     | 1000 | 5,681,280b  | 109.424μs   | -0.87σ       | -0.63%         |
| 0    | ContainerMethodHasBench | benchUndefinedExisting      |     | 1000 | 5,681,280b  | 109.647μs   | -0.11σ       | -0.06%         |
| 1    | ContainerMethodHasBench | benchUndefinedExisting      |     | 1000 | 5,681,280b  | 109.260μs   | -0.70σ       | -0.42%         |
| 2    | ContainerMethodHasBench | benchUndefinedExisting      |     | 1000 | 5,681,280b  | 109.286μs   | -0.66σ       | -0.39%         |
| 3    | ContainerMethodHasBench | benchUndefinedExisting      |     | 1000 | 5,681,280b  | 111.001μs   | +1.96σ       | +1.17%         |
| 4    | ContainerMethodHasBench | benchUndefinedExisting      |     | 1000 | 5,681,280b  | 109.395μs   | -0.49σ       | -0.29%         |
| 0    | ContainerMethodHasBench | benchUndefinedNonexistent   |     | 1000 | 5,681,296b  | 426.954μs   | +1.18σ       | +0.69%         |
| 1    | ContainerMethodHasBench | benchUndefinedNonexistent   |     | 1000 | 5,681,296b  | 423.501μs   | -0.21σ       | -0.12%         |
| 2    | ContainerMethodHasBench | benchUndefinedNonexistent   |     | 1000 | 5,681,296b  | 420.501μs   | -1.42σ       | -0.83%         |
| 3    | ContainerMethodHasBench | benchUndefinedNonexistent   |     | 1000 | 5,681,296b  | 426.688μs   | +1.07σ       | +0.63%         |
| 4    | ContainerMethodHasBench | benchUndefinedNonexistent   |     | 1000 | 5,681,296b  | 422.447μs   | -0.63σ       | -0.37%         |
+------+-------------------------+-----------------------------+-----+------+-------------+-------------+--------------+----------------+

@samdark samdark requested a review from a team June 15, 2024 08:17
Copy link
Member

@vjik vjik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optimization is good.
Revert incorrect rector changes (phpdoc @params mixed $var ...)

@samdark samdark merged commit 5d54255 into master Jun 16, 2024
29 of 30 checks passed
@samdark samdark deleted the performance branch June 16, 2024 21:15
vjik added a commit that referenced this pull request Jun 18, 2024
samdark pushed a commit that referenced this pull request Jun 19, 2024
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.

None yet

5 participants