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.
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:
- 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.
Make sure that makefile has -O3 optimization level enabled. The result is likely to be very different without -O3 directive.
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).
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.
- UserAgentsFile is a path to file containing user agents to be matched.
- [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 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?