Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching is unnecessary #18

Open
Chronial opened this issue Dec 8, 2016 · 2 comments
Open

Caching is unnecessary #18

Chronial opened this issue Dec 8, 2016 · 2 comments

Comments

@Chronial
Copy link

Chronial commented Dec 8, 2016

Caching the results seems unnecessary https://github.com/selwin/django-user_agents/blob/master/django_user_agents/utils.py#L41, since uap-python doesn't actually load the yamls anymore, but they are converted to python in the build process.

See here https://github.com/ua-parser/uap-python/blob/master/setup.py#L20 and here https://github.com/ua-parser/uap-python/blob/master/ua_parser/user_agent_parser.py#L548.

So this is loaded and imported once and then cached by the python importing system anyways.

@acu192
Copy link

acu192 commented Feb 24, 2020

I agree. In fact, caching will likely be slower than simply re-parsing the UA on each request. A warmed-up parser takes microseconds to parse the UA. See below:

Screen Shot 2020-02-24 at 1 01 59 PM

Screen Shot 2020-02-24 at 12 53 23 PM

No reason to put this extra burden on your cache server when it doesn't help you at all.

@boatcoder
Copy link

I'm also seeing some issues with redis parsing and ua-parser==0.15.0 as well. Haven't managed to pin it down yet though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@Chronial @acu192 @boatcoder and others