DeviceDetector.NET
DeviceDetector.NET copied to clipboard
Slow Initial Parse
I wanted to first thank you for a wonderful library and API. It is well-designed and easy to use. It is, in fact, exactly what I am looking for.
The only issue that I have is that it appears the following takes 5 seconds to run the first time (subsequent executions are as expected):
var sut = new DeviceDetector("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36");
sut.Parse();
Is this expected/known behavior? 5 seconds would increase my application startup time by ~25% which would be a drag, so making sure before I do so. :)
Thank you for any assistance/context/insight you can provide.
Hi @Mike-E-angelo, Did you try to use Cache or MSRegexCompiledEngine ?
Thank you for the reply @totpero. I did try those and it still seems to clock in at over 5 seconds when I run the test:
You can view the test here for your review: https://github.com/DragonSpark/Framework/blob/aec495ab9622e58fc6412beff972c45b793d4543/DragonSpark.Presentation.Testing/IsBotTests.cs#L28-L35
the same
Did you try the new version 6.1.0? That version contains performance improvements. Im my case the initial parse is much faster.