kenjis / user-agent-parser-benchmarks

PHP User Agent Parser Benchmarks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

PHP User Agent Parser Benchmarks


Languages

Language:PHP 93.9%Language:HTML 3.1%Language:Shell 3.0%