uap-go
uap-go copied to clipboard
Benchmarks
In #26, it shows that each op takes ~26ms. Is that still accurate?
Also, it'd be nice to have a semi-recent benchmark in the readme.
We have it in production and it consistently takes ~30-40ms on a t3.micro AWS instance. That's the slowest component in a request. Is there a way to speed it up?
We also ran into this. It is by far the most expensive thing in serving a response for our service. Unfortunately, I don't think improving the situation would be easy as most of the time seems to be spent in regexp
and any change to the regular expressions would affect other languages as well.
@oschwald, I was able to drastically reduce the processing by caching the initialized parser.
The trick there is to keep only one instance of the parser around, and then the Parse
method itself is sufficiently fast (2-3ms in our case). Hope this helps
Thanks for the suggestion. We were already caching the parser. I ended up switching us to github.com/avct/uasurfer, which has much better performance.
@Valve how do you cache the initialized parser? Can you pls some code snippets.
https://github.com/ua-parser/uap-go/pull/71 should be a pretty big win. You can switch to my fork if you'd like.