https://github.com/kenjis/user-agent-parser-benchmarks
PHP User Agent Parser Benchmarks
https://github.com/kenjis/user-agent-parser-benchmarks
benchmark php
Last synced: 4 months ago
JSON representation
PHP User Agent Parser Benchmarks
- Host: GitHub
- URL: https://github.com/kenjis/user-agent-parser-benchmarks
- Owner: kenjis
- Created: 2014-11-05T08:12:55.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-26T00:53:16.000Z (almost 11 years ago)
- Last Synced: 2025-04-15T00:35:37.088Z (9 months ago)
- Topics: benchmark, php
- Language: PHP
- Homepage:
- Size: 1.59 MB
- Stars: 29
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PHP User Agent Parser Benchmarks
## Results
|parser |time |peak memory|
|------------------|-------------------|----------:|
|[get_browser()](http://php.net/get_browser) |59.665177 |524288 |
|[browscap-php](https://github.com/browscap/browscap-php) | 4.9851598|50069504|
|[crossjoin\Browscap](https://github.com/crossjoin/Browscap)| 4.6786639|1310720 |
|[ua-parser](https://github.com/ua-parser/uap-php) | 0.6419560|2097152 |
|[woothee-php](https://github.com/woothee/woothee-php) | 0.0876269|524288 |
Note(1): These parsers have different functionality. Generally speaking, it has more functionality, it becomes slower.
Note(2): This benchmark is designed to parse only one user agent with one parser instance.
## How to Benchmark
Install source code.
~~~
$ git clone https://github.com/kenjis/user-agent-parser-benchmarks.git
$ cd user-agent-parser-benchmarks
$ composer install
~~~
Edit `baseUrl` value in `config.php` if you need.
Prepare benchmarks and web server.
~~~
$ sh bin/prepare.sh
$ php -S localhost:8000
~~~
Run benchmarks.
~~~
$ php bin/run-benchmarks.php
~~~
See .
## Check your User Agent
You can check your user agent at .
## How to Check Differences of Detections
Prepare your user agent strings list file and set `userAgentListFile` value in `config.php`.
Run benchmarks and normalize.
~~~
$ php bin/run-benchmarks.php
$ php bin/normalize-output.php
~~~
Show differences.
~~~
$ php bin/show-diff.php
~~~
## Reference
* http://php.net/get_browser
* https://github.com/browscap/browscap-php
* https://github.com/crossjoin/Browscap
* https://github.com/ua-parser/uap-php
* https://github.com/woothee/woothee-php