piwik/piwik — pull request #303 by cbonte (2014-06-07 22:30:32+00:00)
Title: Device detector2 cache

This patch provides an optimization that cache the parsed DeviceDetector.

Using The DeviceDetector2 branch, before the patch, a test case with 100000 line extracted from a real website, the result was :

Total time: 308 seconds
Requests imported per second: 323.87 requests per second

After the patch :

Total time: 144 seconds
Requests imported per second: 690.84 requests per second

The optimization really depends on the number of different user agents and the bulk size but in the worst case, we can expect nearly the same performance as without the patch.

Note : initially, I expected to provide the patch for the master branch but I prefered to provide one for the DeviceDetector2 branch, using CacheStatic instead of a static array.