Mobile detect is being called too many times

Bug #1427031 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Robert Lyon

Bug Description

In init we call isMobile() twice and that can be expensive. For me it meant calling Mobile_Detect::match 524 times rather than 262 times when we call it once and remember it's answer.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/4336

Revision history for this message
Robert Lyon (robertl-9) wrote :

In fact checking if device is mobile only every needs to be done one per session and not once per page load - as the device is not likely to change mid stream (unless dev testing) so we don't want prod sites testing for it on every page/block/artefact load.

summary: - Mobile detect is checking for UA string twice
+ Mobile detect is being called too many times
Changed in mahara:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Robert Lyon (robertl-9)
milestone: none → 15.04.0
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/4336
Committed: http://gitorious.org/mahara/mahara/commit/9813cbb92d6b35ecf80f8b145a36a3e4b58a1fd1
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit 9813cbb92d6b35ecf80f8b145a36a3e4b58a1fd1
Author: Robert Lyon <email address hidden>
Date: Mon Mar 2 15:34:08 2015 +1300

Reducing the number of calls to Mobile_Detect->isMobile() (Bug #1427031)

We seem to be calling it on every page load - so for a page with lots
of blocks it means a lot of calls.

When really we should call it once when a user first arrives as they
won't be switching devices during their session.

Change-Id: Id939ad83c5acfdbcdd358691def25bd2e5f5a592
Signed-off-by: Robert Lyon <email address hidden>

Aaron Wells (u-aaronw)
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.