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

performance #7

Open
classjing opened this issue Sep 3, 2021 · 1 comment
Open

performance #7

classjing opened this issue Sep 3, 2021 · 1 comment

Comments

@classjing
Copy link

Hello, after using it, I found that each Java parsing takes about 20ms, but PHP parsing can be completed within about 5ms, Java performance is too poor, I wonder if you have noticed the performance problem, looking forward to your recovery, thank you

@mngsk
Copy link
Owner

mngsk commented Sep 9, 2021

Hello, thanks for your comment.

I know that the PHP version does a concatenation of all the regexes into a single one, which they use to see if there's any match before trying to actually parse the user agent. I didn't implement that behaviour in my version but maybe it's worth a try. Unfortunately I don't know when I will be able to work on that. If anyone has a chance, that'd be very helpful.

The other thing that I remember is that the PHP version has an internal cache mechanism which I didn't implement in java because I think that's out of the scope of this project; there are several cache libraries in java to choose from which can help improve performance in live environments with repetitive user agents.

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

2 participants