RhoElements Performance Improvements #2
Configuration Settings & Other Tips to make your RhoElements application Run Faster
An overview of the RhoElements performance improvement drive
The great thing about an open developer community is the ability to interact and work at a group and individual level with many of the developers out there. It really allows us to prioritize product feature sets and focus on the things that the greater community feels are a priority. It also allows us to get real-time feedback on the product and address any concerns that may arise in a more agile process. The RhoMobile Suite team really prides itself on being agile and producing a product that not only meets the needs of those developing enterprise cross-platform applications, but also does so with the utmost level of quality and performance. Recently there have been concerns that HTML5 cannot deliver a performant application, and with the latest announcements around Facebook and their application it has even more people wondering.
Introduction
In the second of a series of blog posts I will discuss the configuration settings present in RhoElements 2.1 which you can tweak to make your applications run faster. If you missed my first blog post a couple of weeks ago you can find it at https://developer.motorolasolutions.com/community/rhomobile-suite/docs/developer-reference/blog/2012/09/24/rhoelements-performance-improvements-1, that's where I shared our latest Motorola WebKit browser for Windows Mobile (Embedded Handheld) / CE. The tips in this blog post are aimed at Windows Mobile / CE users.
Configuration Settings
What is the configuration file and where is it?
The configuration file is an xml document which is used to define the behaviour of your RhoElements application, you can find a detailed description of it at http://docs.rhomobile.com/rhoelements/ConfigurationSettings along with an explanation of what all the configuration parameters do. If you are using the shared runtime you will find the config file at
\Program Files\RhoElements\Config\Config.xml
If you are using a native RhoElements application you will find your configuration file at
\Program Files\
\Config\Config.xml
The tips below involve modifying the configuration file used by your application.
Configuring the Hourglass / Wait cursor
By default whenever you navigate from page to page you will see a wait cursor animation appear as a spinning coloured disc. In some circumstances users may see this as visually distracting, especially if navigation times are very low and application users may perceive a performance increase by disabling the wait cursor. For historical reasons the configuration file uses the term 'hourglass' for the wait cursor.
The wait cursor is configured with the following settings:
To stop the wait cursor displaying you can set the 'HourglassEnabled' parameter to '0'.
Alternatively you can prevent the hourglass module from being preloaded to have the same effect, see http://docs.rhomobile.com/rhoelements/ConfigurationSettings#optimizing-the-runtime.
It is possible to hide or show the hourglass manually from within your code if your application wants to give some feedback to the user, for example you may be uploading a file to an FTP site or logging in to a server. Because the wait cursor is written in native code it will have less performance impact than doing the same in HTML. To hide or show the wait cursor from Javascript use the following code snippet:
function showHourglass()
{
hourglass.visibility = 'visible';
}
function hideHourglass()
{
hourglass.visibility = 'hidden';
}
For more information see the API at http://docs.rhomobile.com/rhoelements/hourglass
Default Meta Tags
Default meta tags are EMML tags which are applied to every page, following a navigation:
In the above example after a page load the Signature Capture box will be shown at position (30,130) with size (200x100) with a border; the signal indicator will also be shown.
In RhoMobile Suite 2.1 default meta tags are expensive and should be avoided if necessary, for example 2 simple tags can add as much as half a second to each page navigation, increasing with the more that are used. Version 2.2 will introduce performance improvements for default meta tags but in 2.1. As an example of a way to avoid default meta tags, the signal module visibility is persistent, it is not necessary to re-specify the colour and location for each page load so in this particular case the tag can be replaced with Javascript on the application home page.
The Scanner is disabled during page navigation, whilst this cannot be configured in version 2.1 it will be configurable in 2.2. Enabling the scanner in a default meta tag will cause the scanner to first be disabled when the navigation starts and then re-enabled after the navigation has finished; this can add as much as half a second to the page load and it is recommended to only enable the scanner on pages where it will be used rather than on every page via a default tag.
Logging
Having logging turned on will have only a minor impact on application performance, this is because the logging functionality runs at lower priority to the rest of the application. Nevertheless in order to squeeze every last bit of performance out of your application you can turn logging off using the following configuration settings:
It is however recommended that error logs are still turned on just in case anything critical does go wrong (e.g. incorrect installation), you will have a means to find out why.
"Debug" Controls
The "Debug" Controls are by design only provided for the application developer to debug their application, they are not necessarily visually appealing and can allow the user to disrupt your designed program flow. In RhoElements 2.1 their use can impact performance by upwards of 100 milliseconds when compared to performing the same behaviour in Javascript or Ruby.
The debug controls are:
AddressBar http://docs.rhomobile.com/rhoelements/addressbar
BackButton http://docs.rhomobile.com/rhoelements/backbutton
ForwardButton http://docs.rhomobile.com/rhoelements/forwardbutton
ReloadButton http://docs.rhomobile.com/rhoelements/reloadbutton
StopButton http://docs.rhomobile.com/rhoelements/stopbutton
GoButton http://docs.rhomobile.com/rhoelements/gobutton
QuitButton http://docs.rhomobile.com/rhoelements/quitbutton
MinimizeButton http://docs.rhomobile.com/rhoelements/minimizebutton
HomeButton http://docs.rhomobile.com/rhoelements/HomeButton
SipButton http://docs.rhomobile.com/rhoelements/sipbutton
ZoomTextButton http://docs.rhomobile.com/rhoelements/zoomTextButton
Other Tips
Disabling Regular Expressions
Regular Expressions are a way for RhoElements applications to recognise EMML 1.0 syntax, http://docs.rhomobile.com/rhoelements/EMMLOverview which means applications written to target Motorola PocketBrowser will work unmodified in RhoElements.
Applying all the regular expressions which ship by default in RhoElements for each meta tag, Javascript and Ruby call listed in the Mobile API reference at http://docs.rhomobile.com can be very expensive. If you do not require your installation to be backwardly compatible with applications written for PocketBrowser you can modify your RegEx.xml file as follows:
If you are using the shared runtime you can find your RegEx.xml file at:
\Program Files\RhoElements\Config\RegEx.xml
If you are using a native RhoElements application you will find your RegEx file at
\Program Files\
\Config\RegEx.xml
Removing all regular expressions can increase your Mobile API parsing speed by as much as 10 times. In RhoElements 2.2 there will be a configuration option to disable regular expression parsing by default so there will be no need to modify your RegEx.xml file.
Use of remote viewers
And finally... In the course of performance analysis one issue crops up continuously, the use of remote viewers such as those developed by http://www.soti.net/. Remote viewers are invaluable for mobile application development but by their very nature can impact your device's performance, in order to achieve consistent results it is recommended to disable your remote viewer to get a true picture of your application's performance, also ensuring you have no other CPU intensive tasks running in the background.
Anonymous (not verified)
3 Replies
The thing about the Natives interacting with nature and the elements, is that their crops are expensive, and are used by disabled people.
When will you be covering performance enhancements for non-Windows CE devices?
Hi John, we plan on covering all supported device types with performance improvements, as a case in point the latest Webinar at <a href="/docs/DOC-1649">https://developer.motorolasolutions.com/docs/DOC-1649</a> covers general HTML 5 performance improvements. We have taken the concious decision to initially concentrate on Windows Mobile / CE devices as these were the biggest ask from our community.