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

Blog

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.

DIY

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]

Where:
- 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)
Mike
>

Products Team

Other posts by Products Team
Contact author

Name:
Email:
Subject:
Message:
x

Tags

.NET 4G 51Degrees 5G Acer Adform Adtech Advertising Afilias Alcatel Amazon AMP Analysis Analytics Android Apache API Apple Asian Market ASP.NET Asus Blackberry Browser C C# Centro Chrome Cloud CMS CPU CSS3 Data Data Blog Data File Daydream Design Detection Developers Device Device Data Device Detection Device Intelligence Device Models Device property DeviceAtlas Disney dmexco DotNetNuke Download ebay Ericsson Event Facebook Firefox Foundation Framework Galaxy git repositories Google Google Analytics Google Daydream GPU GSMA Guess HAProxy Hash Trie HTC HTML5 HTTP HTTP Headers Huawei Infinix Ingeniux Internet usage iOS iOS 13 ipad iPadOS iPhone iPhone 11 Java Javascript Kentico LG Liferay LTE m.dot Memory Memory leak Meta Data Microsoft Mobile Mobile Analysis Mobile Analytics Mobile Devices Mobile Marketing Mixer Motorola Mozilla MWC MWC 2017 MWC16 Native Apps NET New Release News Nexus NFC NGINX Nokia OnePlus 5 Opera Operating System Oppo Optimisation OS Patent Performance PHP Press Release Price Band programmatic Publishers Python Redirection Research Responsive Images Responsive web design RESS Review RTB RWD Safari Samsung Scala ScientiaMobile SEO Server Server-side optimisation Seznam.cz Sitecore Smart TV Smartphone Smartwatches Sony Swedish Beers Tablet Tencent Testing Tips Tutorial Umbraco Update User Agent User-Agent Valgrind Varnish Varnish Cache Video Vodafone VoLTE Web Web Apps Web content management Webtrekk White Paper Widgets WiFi Windows WURFL Xiaomi Xperia ZTE