You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Class to increase the performance of Mobile Detect lib.
Mobile Detect uses a loop with regular expressions to determine the device, and PHP is very slow on this. By reducing the size of the string in the regular expression we get increased performance.
The information theory says that the most frequent words provide less information. Then if it appears in 100% of cases the word "Mozilla" can exclude it from the regular expression as it will be irrelevant in determining the device in the User Agent.
What we do is create an array ($irrelevant) with the list of "irrelevant words" to exclude of User Agent.
Great!
I just wanted to post an performance Issue because the original MobileDetect calls the preg_function over 1000 times which takes a lot of time. Thanks to your Class my Wall Time decreased by about 80ms!
Still not perfect, but way better. Thanks alot
I like the idea, I cannot add it to the current iteration (2.x) since this version was meant to detect mobile devices and tablets. An optimisation comes with a lot of UA pattern conflicts which I cannot oversee at this point in time. I will add the project to the front page, maybe someone is interested in this topic.
Class to increase the performance of Mobile Detect lib.
Mobile Detect uses a loop with regular expressions to determine the device, and PHP is very slow on this. By reducing the size of the string in the regular expression we get increased performance.
The information theory says that the most frequent words provide less information. Then if it appears in 100% of cases the word "Mozilla" can exclude it from the regular expression as it will be irrelevant in determining the device in the User Agent.
What we do is create an array ($irrelevant) with the list of "irrelevant words" to exclude of User Agent.
Source: https://bitbucket.org/lanaguani/mobile-detect-fast/
The text was updated successfully, but these errors were encountered: