• About Us
  • Blog
  • Basket
  • Account
  • Sign In


Calculating Detection Speed

Published on Tuesday, November 25, 2014

Calculating Detection Speed

How do we know each detection only takes 0.0016ms?

Earlier this year we published a blog post called "why fast device detection matters". Amongst other things this blog contained test descriptions and results for 3 different, moderately-priced platforms. For each test case a table was created to show how device detection performed with the given number of threads on that particular hardware platform. The focus of the article was to demonstrate the amount of detection you can potentially get on low-end server and consumer equivalent hardware.

The blog post has now been updated to describe how we measure detection time for a single device, and hence how we got the number of 0.0016ms. Essentially what we did was: run the test with one thread and divide one second by the average number of detections we obtained during that test. You can easily reproduce this test on any platform with GCC, just follow the guide below. The following tutorial assumes some familiarity with GCC and source code editing.


1: Download our C distribution from sourceforge. Unpack the archive.

Arrow pointing towards the next step.

2: For our test we will be using Trie. You will need to make the following modifications to achieve the best performance on your system. In 'src/trie/PerfTrie.c' change the THREAD_COUNT value as follows:

Arrow pointing towards the next step.

- If you want to measure how many detections per second your system can achieve, set THREAD_COUNT equal to the number of virtual CPU cores available on your system. I.e. for 4-core CPU with 8 virtual cores the ideal THREAD_COUNT is 8.

- If you want to measure the detection time for a single device, then set THREAD_COUNT to 1. You will then need to divide 1000 milliseconds (1 second) by the average number of detections you get after running this test.

Arrow pointing towards the next step.

Make sure that makefile has -O3 optimization level enabled. The result is likely to be very different without -O3 directive.

Arrow pointing towards the next step.

3: Now run the relevant build file (on Windows) or use the terminal to compile with makefile on UNIX (makefile can also be used on Windows if you have GCC installed).

Arrow pointing towards the next step.

4: Once compilation is complete you will see 4-5 programs in the root folder of 51Degrees C distribution. Execute PerfTrie as follows:

PerfTrie.exe TrieDataFile UserAgentsFile [Properties]

- TrieDataFile is the path to 51Degrees Trie device data file. A Lite version of this file is supplied with the detector. But this may be a good opportunity to try our Premium or Enterprise data file for free.
- UserAgentsFile is a path to file containing user agents to be matched. You can download such a list containing a million user agent strings from http://51degrees.com/Million.zip.
- [Properties] is a comma-separated list with device properties you want to be returned. Device Id is used if no Properties are selected.


Not yet a 51Degrees user? In that case download our free evaluation and compare us against your current tool, you may be surprised by the results. Other solutions on the market may claim to be the fastest, most accurate or both, so why not test that out for yourselves rather than rely on unproven claims?

External Resources

Photo "Plugged" by Keoni Cabral, modified by 51Degrees, is licensed under CC BY 2.0

Comments (0)

Products Team

Other posts by Products Team
Contact author



.NET 2013 2014 4G 51Degrees 5G A.C.Roma A7 ABI Acer Adtech Affiliate Marketing Afilias Alcatel Amazon AMP Analysis Analytics Android Android 5.0 Lollipop Android Kitkat Android Lollipop Android Media Stick Apache API Apple Apple TV Archos Asha Asian Market ASP.NET Asus Australia Big Data Black Friday Blackberry Blink Browser C C# Case Study CeBIT CES Chrome Cloud CMS combinations Comparison Competition CoolPad COTW Cron CSS3 Data Data Blog Data File Data Model Daydream Denver Design Desire Eye Desktop Detection Developers Device Device Data Device Detection Device Intelligence Device Popularity Device property Device Types Device Use DeviceAtlas Display dmexco DoCoMo Doogee DotNetNuke Download Drupal Email EReader E-Reader Ericsson Evaluation Event Examples EXPLAY Rio Facebook feature Firefox Firefox OS Fly Foundation Framework France Galaxy S3 Galaxy S5 Galaxy Tab A Galaxy Tab A 8.0 Galaxy Tab A 9.7 Germany git repositories Global Google Google Daydream GSMA HAProxy Hardware Hisense HTC HTC ONE MAX HTC OS HTML5 HTTP HTTP Headers Huawei HUAWEI. UPDATE HUDL Huwaei IBC Icemobile Prime 4.0 IE IFA IIS Image Optimiser Image Optimizer India Infographic Ingeniux Internet usage iOS iOS 7 iOS 8 ipad iPhone iPhone 6 IsEmailBrowser IsWebApp Italy Japan Java Javascript Jolla Kentico Keynote Kindle Kindle Fire Kindle Fire HD Leagoo Lenovo LG Location Log File Analysis LTE Lumia m.dot macOS Map Memory Meta Data Mi 4S Micromax Microsoft Miia Style Mobile Mobile Analysis Mobile Analytics Mobile Devices Mobile Marketing Mixer Module Motorola MVC4 MWC MWC 2017 MWC16 MyPhone Native Native Apps NET New Release News News Letter Nexus Nexus 6 Nexus 9 NFC NGINX Nokia Nokia 3310 Non-Mobile NVIDIA Omate On7 OnePlus 5 Opera Opera Mini Operating System Optimisation OS OSX 10.10 OTA Panasonic Patent PC Pebble Performance phablet phone PHP Poland Presentation Press Release Price Band PRIV programmatic PS4 Publishers Python QMobile QR Codes Redirection Research Reseller Responsive Images Responsive web design RESS Review reviews RIM Ringmark RTB RWD Safari Samsung Scala ScientiaMobile Screen Screen resolution Screen Size SEO Server Server-side optimisation Set Box Set Top Box Sharepoint Shark 1 SHIFT phones Sitecore Sitecore version 9 SLUSH Smart TV Smartphone Smartphones Smartwatches Snapdragon Sony Sony Xperia Spain Swedish Beers Symbian Tablet Tablets Tesco Testing Tips Top 5 TOTW Tutorial TV UDS UK Umbraco Update updates US User Agent UserAgent User-Agent Vendors Version 3 Video VoLTE VR Wearable Web Web Apps Web content management WebKit WebMatrix White Paper Widgets Widnows WiFi Wiko Wileyfox Windows Windows Phone WURFL Xbox XBox One Xiaomi Xperia Xperia z Yosemite Z10 ZenFon 2 ZOPO ZTE