Mobile-Detect icon indicating copy to clipboard operation
Mobile-Detect copied to clipboard

Use cache for isTablet and isMobile

Open adrienbrault opened this issue 8 years ago • 2 comments

Hey,

I benchmarked one of my pages with blackfire, and noticed that the mobile detector was doing a lot of preg_match. I probably call isMobile() 100+ times.

I think there's also this github issue about the problem: https://github.com/serbanghita/Mobile-Detect/issues/140

This patch leverages the cache property for isMobile() and isTablet() calls

adrienbrault avatar Sep 07 '16 14:09 adrienbrault

Hello ?

adrienbrault avatar Nov 08 '16 15:11 adrienbrault

I'm not able to perform a review at this time. I'm focused on small patches. I can review this in 2017. Are you using these updates in production?

serbanghita avatar Nov 10 '16 10:11 serbanghita