toolmantim/user_agent_parser — pull request #13 by hexgnu (2013-11-12 04:54:39+00:00)
Title: Introduce caching to circumvent issue with using UserAgentParser.parse

What
=====

So it seems to be a pretty recurring issue based on previous PR's that `UserAgentParser.parse` can cause performance issues. I found this out the hard way by loading 30 million user agent strings and not realizing that was how it was defined.

This PR aims to help by introducing a cache that allows users to still rely on the same functionality but enjoy the much faster speed.

How to test
=========

I threw a few cache specific tests in there but also made sure the tests themselves still worked.