Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koenpunt/yaml-php-benchmark
YAML PHP Comparison Benchmark
https://github.com/koenpunt/yaml-php-benchmark
Last synced: about 1 month ago
JSON representation
YAML PHP Comparison Benchmark
- Host: GitHub
- URL: https://github.com/koenpunt/yaml-php-benchmark
- Owner: koenpunt
- Created: 2014-03-23T22:50:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-08-31T08:26:52.000Z (about 1 year ago)
- Last Synced: 2023-08-31T21:18:49.007Z (about 1 year ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# YAML PHP Benchmark
### Why?
I often see Symfony/Yaml being user for YAML processing in PHP, but I myself uses PECL YAML instead and was wondering about performance, so I'd setup a simple benchmark test.
### Requirements
To run the tests yourself make sure you have met the following requirements:
- [PECL YAML](http://pecl.php.net/package/yaml) *(uses LibYAML)*
- [Symfony/Yaml](http://symfony.com/doc/current/components/yaml/introduction.html) *(pure PHP)*
- [Spyc](https://github.com/mustangostang/spyc) *(pure PHP)*Installing PECL Yaml can be done by running:
```bash
$ pecl install yaml
```Symfony/Yaml and Spyc should be installed using [Composer](https://getcomposer.org/) by running:
```bash
$ composer install
```
*NB. I did not use composer's autoload feature as it may interfere with the test results*### Results
The test pointed out that Symfony/Yaml is by far the *slowest* parser:
```bash
$ php -f ./benchmark.phpPECL YAML
Total: 0.24177002906799
Average: 0.00024177002906799
Total: 0.21856594085693
Average: 0.00021856594085693Symfony YAML
Total: 5.2555449008942
Average: 0.0052555449008942
Total: 2.9924311637878
Average: 0.0029924311637878Spyc YAML
Total: 3.5280780792236
Average: 0.0035280780792236
Total: 2.0810060501099
Average: 0.0020810060501099
```
*In seconds per a 1000 runs*This test doesn't verify the correctness of the parser, only the speed.