Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Installation & Setup
Fuelphp Agent::is_mobile performances
I just made a new fresh install of Fuelphp, and the performances are worrying, or at least way more than what i'm used to with Fuel
500 ~ 600 ms for the page to load
65MB ram used
Nothing run on the page : controller method empty, template empty, no views, no sql queries or any operations.
Packages always loaded : Orm, parser, assets, auth (Twig templating used, and so Theme instance is)
In my main controller before function, I detect mobile with Agent::is_mobiledevice(). I thought it could be it, as the cached browscap file is pretty large.
Am I right, and if no, what can cause it ?
Quite possible, the browscap has expanded quite rapidly over the last period.
Quick fix is to have PHP handle the browscap data, through the php.ini configuration. Agent will automatically use it if available, and no longer create it's own agent cache.
I'm a little tired, I didn't even think to comment the line and test...
It turns out it was the reason, I'll give a try to the method you gave.
I tried, and the result is not better. The ram consumption is normal, 2.80MB ~, but the page load is the same.
Well I can't use the Agent Class is theses circumstances, that's too bad because it was quite useful.
Edit : If it can help, i found a workaround. The fuel package "special_agent" override Fuel mobile and tablet Agent class detection, using Mobile_Detect librairy. Performances are back, adding barely 0.5ms to pageload.
Can you post a link to that package, for other users having the same issue?
Yup, my bad (i also edited title and tags)
The package class is extended from Agent class, override only mobile detect and add useful method such as Agent::is_tablet() and so on.
Looked at it, but it's virtually nothing. I wonder if it would not be bether to add the "Mobile Detect" library directly and integrate it into Agent.
You're right, it's just a wrapper for the librairy. If you add it, it would be more convenient to have it natively available. Because the current agent class is unusable : Who can afford an extra 700ms in his application pageload for this ?
I didn't test it, but there is another solution recomended by the browscap project :
According to what i read, it's pretty fast too but the class itself just seems to be an optimized cache, but still use browscap and I highly doubt that it's as fast as Mobile_Detect. Bright side is that you could use it to optimize the entiere agent class, and not only mobile detection.
The one they recommend is a fork of GaretJax' project, our Agent is an optimized fork of that, so that one is even slower.
The discussion about the future of Agent can be found here:
I've added your suggestion to it.
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion