Skip to content
PHP User Agent Parser Benchmarks
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benchmarks
bin
cache
data Remove data/ua-list.txt Nov 11, 2014
libs/php-recipe-2nd
.gitignore
README.md
benchmark.php
check-your-ua.php
composer.json
composer.lock
config.php
index.html
server.sh

README.md

PHP User Agent Parser Benchmarks

Results

parser time peak memory
get_browser() 59.665177 524288
browscap-php 4.9851598 50069504
crossjoin\Browscap 4.6786639 1310720
ua-parser 0.6419560 2097152
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 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

You can’t perform that action at this time.