Home

Awesome

PHP User Agent Parser Benchmarks

Results

parsertimepeak memory
get_browser()59.665177524288
browscap-php4.985159850069504
crossjoin\Browscap4.67866391310720
ua-parser0.64195602097152
woothee-php0.0876269524288

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 http://localhost:8000/benchmark.php.

Check your User Agent

You can check your user agent at http://localhost:8000/check-your-ua.php.

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