[php-src] PR #14166: ext/bcmath: Use SIMD for trailing zero counts during conversion
| From: | SakiTakamachi | Date: | Tue, 07 May 2024 13:35:00 +0000 |
| Subject: | [php-src] PR #14166: ext/bcmath: Use SIMD for trailing zero counts during conversion | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-26067@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/14166
Author: SakiTakamachi
benchmark: https://github.com/php/php-src/pull/14132
## before
```
// 1
Time (mean ± σ): 589.3 ms ± 12.8 ms [User: 584.2 ms, System: 4.3 ms]
Range (min … max): 574.5 ms … 614.4 ms 10 runs
// 2
Time (mean ± σ): 638.1 ms ± 9.2 ms [User: 634.1 ms, System: 3.2 ms]
Range (min … max): 628.0 ms … 658.0 ms 10 runs
// 3
Time (mean ± σ): 713.0 ms ± 6.3 ms [User: 709.0 ms, System: 3.2 ms]
Range (min … max): 704.6 ms … 724.2 ms 10 runs
```
## Final state (after removing unnecessary code)
```
// 1
Time (mean ± σ): 566.5 ms ± 4.7 ms [User: 563.4 ms, System: 2.4 ms]
Range (min … max): 558.6 ms … 572.7 ms 10 runs
// 2
Time (mean ± σ): 603.4 ms ± 6.1 ms [User: 599.2 ms, System: 3.5 ms]
Range (min … max): 594.0 ms … 613.6 ms 10 runs
// 3
Time (mean ± σ): 583.3 ms ± 8.0 ms [User: 579.3 ms, System: 3.3 ms]
Range (min … max): 568.0 ms … 595.1 ms 10 runs
```
## after SIMD
```
// 1
Time (mean ± σ): 591.4 ms ± 7.6 ms [User: 587.5 ms, System: 3.1 ms]
Range (min … max): 579.6 ms … 605.6 ms 10 runs
// 2
Time (mean ± σ): 650.3 ms ± 7.5 ms [User: 644.8 ms, System: 4.7 ms]
Range (min … max): 642.0 ms … 667.1 ms 10 runs
// 3
Time (mean ± σ): 618.2 ms ± 14.3 ms [User: 614.2 ms, System: 3.1 ms]
Range (min … max): 602.2 ms … 642.1 ms 10 runs
```
## after UNEXPECTED
```
// 1
Time (mean ± σ): 572.0 ms ± 8.0 ms [User: 567.5 ms, System: 3.7 ms]
Range (min … max): 560.7 ms … 581.6 ms 10 runs
// 2
Time (mean ± σ): 603.6 ms ± 7.0 ms [User: 599.9 ms, System: 3.1 ms]
Range (min … max): 594.1 ms … 616.5 ms 10 runs
// 3
Time (mean ± σ): 584.8 ms ± 13.2 ms [User: 580.2 ms, System: 3.8 ms]
Range (min … max): 574.2 ms … 615.4 ms 10 runs
```
## FYI: without SIMD
```
// 1
Time (mean ± σ): 604.4 ms ± 23.9 ms [User: 599.6 ms, System: 4.0 ms]
Range (min … max): 588.7 ms … 669.7 ms 10 runs
// 2
Time (mean ± σ): 658.2 ms ± 13.6 ms [User: 654.8 ms, System: 2.7 ms]
Range (min … max): 644.0 ms … 692.3 ms 10 runs
// 3
Time (mean ± σ): 789.0 ms ± 8.6 ms [User: 784.5 ms, System: 3.7 ms]
Range (min … max): 779.7 ms … 809.5 ms 10 runs
```