Check out the latest documentation.

Introduction

Two device detection methods are available with the C solution.

Pattern

Pattern is the same matching method used by our .NET, Java and PHP APIs. However all the necessary data, regular expressions and other pattern recognition methods are provided in the 51Degrees C source code file. This results in a faster implementation of the method requiring very little working memory. The pattern method is ideally suited to real time device detection for web sites. As all the detection logic and data is compiled into the executable a recompilation will be required when updates are provided. Therefore the optimal implementation is via dynamic rather than static linking.

Trie

Trie indexes require a significant amount of data and are therefore less memory efficient than the pattern matching method. However they are exceptionally fast achieving millions of detections per second. The trie method is suitable for offline analysis of log files or web sites receiving millions of unique requests per minute from an extremely large range of devices.

Our C solution contains source code and data for each of these methods licenced under the AGPL. All our Premium data licences allow the commercial use of this software with our Premium data.

This solution includes the following programs.

  • Command line process which takes a user agent via stdin and returns a device id, or other properties, via stdout.
  • Command line performance evaluation program which takes a file of user agents and returns a performance score measured in detections per second per CPU.
  • A windows only multi-threaded performance evaluation program.
  • A windows example web site which uses the 2 detection methods and compares the results side by side for the requesting browser.

The following section provides a quick start guide to the first item. Subsequent sections explain the performance evaluation programs, and use in a demonstration web site.