https://github.com/yookoala/benchmark-php-use
https://github.com/yookoala/benchmark-php-use
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yookoala/benchmark-php-use
- Owner: yookoala
- Created: 2019-10-04T08:27:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-04T08:33:15.000Z (almost 6 years ago)
- Last Synced: 2025-02-10T04:42:28.214Z (5 months ago)
- Language: PHP
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Autoloading Benchmark
Aims to test [if there is performance difference][1] between:
1. multiple `use` statements to the subclass; and
2. a single `use` statement to the parent namespace.[1]: https://stackoverflow.com/questions/58231277/composer-autoload-performance
## Preparation
Run the generation script first:
```
php gen.php
```Then run the 2 examples separately:
```
php example1.php; php example2.php
```## Result
We are testing a ridiculous number (100,000) of subclass here. The difference might
not be relevant in real life situation. But there is consistent difference between
the 2 examples on my machine:```
Example 1 executed in 0.202406
Example 2 executed in 0.159941
```The 0.04s difference is probably the time need to parse the 999,999 more `use`
statements.