RhoElements Performance Improvements #4

Anonymous (not verified) -
7 MIN READ
16

Configuration Settings and other Tips introduced in 2.2 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.

Introduction

To coincide with the release of RhoMobile Suite 2.2 I wanted to share some of the new ways we have improved performance for users of RhoElements on Motorola Devices running Windows Mobile (Embedded Handheld), CE and Android.  This blog builds on my earlier blog offering configuration settings to improve performance (https://developer.motorolasolutions.com/community/rhomobile-suite/docs/developer-reference/blog/2012/10/08/rhoelements-performance-improvements-2) and you'll find we've improved the out of the box experience compared to 2.1.

New Configuration Options

Although all the new configuration options are documented online at http://docs.rhomobile.com/rhoelements/ConfigurationSettings I wanted to highlight the new ones and explain exactly how they can improve performance.  Details of where to find the configuration file are given in my previous blog at https://developer.motorolasolutions.com/community/rhomobile-suite/docs/developer-reference/blog/2012/10/08/rhoelements-performance-improvements-2.

UseRegularExpressions

Default Value '0' meaning "Do not use Regular Expressions".  Only applies to Windows Embedded Handheld (WM) and Windows CE.

  

   http://www.mysite.com" name="Menu"/>

  

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 with RhoElements for each meta tag, Javascript and Ruby call listed in the Mobile API reference at http://docs.rhomobile.com can cause slower navigation.

In my earlier blog I explained how applying regular expressions can be expensive in 2.1 and offered work arounds for improving performance.  In 2.2 the out of the box experience has been improved to not use any Regular Expressions by default, this means that applications written for PocketBrowser will not necessarily run in RhoElements 2.2.  In order to enable regular expressions just set the 'UseRegularExpressions' configuration setting to '1' but you will take a performance hit in doing so.

If you wish to be more intelligent about applying Regular Expressions I have written a separate blog on porting PocketBrowser applications to RhoElements (https://developer.motorolasolutions.com/community/rhomobile-suite/docs/developer-reference/blog/2012/10/17/porting-your-pocketbrowser-application-to-rhoelements); this also goes into more detail of what exactly the Regular Expressions are doing.

DisableScannerDuringNavigation

Default value '1' meaning "Disable the scanner during navigation".  Applies to both Windows and Android applications running RhoElements on Motorola devices.

  

By default if you are on a page which is using the Scanner and you navigate away from that page the Scanner will be automatically disabled, meaning if you press the trigger button or initiate a soft start no laser will be emitted.  Because disabling the scanner is done at the hardware level it can take as much as half a second for the operation to complete, meaning if an application wants to use the scanner on multiple pages the navigation will be slowed down unnecessarily. 

Consider a navigation between two pages, both of which have the following in their header:

Navigating between these two pages will first disable the Scanner and then re-enable it once the second page is loaded.  The reason for disabling the Scanner is to ensure a default Scanner state however to improve navigation performance in this scenario you can set "DisableScannerDuringNavigation" to '1'; doing so will mean the scanner remains enabled during the navigation to the second page, remembering all previously set decoder properties and scanning settings.  For a further performance improvement all scanner control logic can now be removed from the second page as it will still be remembered after being set on the first page.

Cache

Default value '5MB' meaning "Cache 5MB worth of browser content into RAM (scripts / images / pages)".  Applies to both Windows and Android applications running RhoElements on Motorola devices in 2.2.

  

RhoElements 2.1 and earlier had no form of browser caching and this has been corrected in 2.2, by default RhoElements will cache 5MB of scripts, images and pages into RAM.  This is browser cache, not to be confused by Application Cache or Cookies.  The maximum amount of cache available will depend on the device on which RhoElements is being run.

Cache is stored in memory and not written out to the device file system or SD Card.  The RhoElements refresh button (http://docs.rhomobile.com/rhoelements/reloadbutton) will request a reload from the server rather than the cache.

Other Tips

Here are some additional tips which didn't make it into my previous performance blog on configuration settings.

Default Meta Tags

In my previous performance blog I advised not to use default meta tags wherever possible as processing them can take a while.  In RhoElements 2.2 I retract this advice, there have been a number of improvements around the handling of Default Meta Tags which means they can now be used:

  • Internally we have improved the effeciency of how we process default meta tags, previously they were being re-parsed on each page load but they are now cached.
  • Regular Expressions were being applied to each meta tag on each page load.  Given we now disable regular expression parsing by default (as explained above) there is a further performance improvement.
  • Enabling the scanner in a default meta tag is a common user scenario.  With the introduction of the DisableScannerDuringNavigation configuration setting you can now enable the scanner in a default meta tag without worry of a performance hit, just be sure to set DisableScannerDuringNavigation to '0'.  Also be aware that doing this will cause a log to be written on each navigate telling you you tried to enable the scanner whilst it was already enabled, obviously this is to be expected.

  

RhoElements JavaScript objects

In RhoElements on Motorola Devices we currently use NPAPI to inject JavaScript objects onto the page, this gives you the capability to write functions like:

function enableScanner()

{

     scanner.enable();

}

without getting a Javascript syntax error.

Some people have asked me if they can improve their performance by not loading these NPAPI objects if they don't need them:

  

  

     

     

     

     

     

     

  

The RhoElements JavaScript APIs (Scanner, CardReader, Imager etc) are injected onto the page by the PreloadJSObjects setting.  The other 'Legacy' objects refer to http://docs.rhomobile.com/rhoelements/generic, http://docs.rhomobile.com/rhoelements/odax, http://docs.rhomobile.com/rhoelements/nosip, http://docs.rhomobile.com/rhoelements/airbeam

and http://docs.rhomobile.com/rhoelements/apd respectively.

Testing on an MC75a running WEH 6.5 I only see a maximum navigation improvement of 23ms when everything is removed, I would recommend keeping the default values and pre-loading all of these objects.

Preloading Modules

Preloading modules is not the same as preloading Javascript objects, discussed above.  Preloading modules tells RhoElements that you intend to use specific functionality such as the card reader in your application, this means that the functionality can be loaded when RhoElements is first initialised.  If for example you had an application that used the card reader half way through the application flow, if you had not pre-loaded the card reader it will be done at runtime when the functionality is first used and could impact the user experience.

It is recommended you pre-load all modules which you intend to use in your application.  This topic is also explained in greater detail at http://docs.rhomobile.com/rhoelements/ConfigurationSettings#optimizing-the-runtime

By default a number of commonly used modules are already preloaded:

    

    

  

    

  

Because loading modules is such a small part of RhoElements' initialisation you will find removing the default pre-loads does not have a significant impact on RhoElements' start up time.

ResizeOnSIP Config option

In previous incarnations of RhoElements and PocketBrowser the ResizeOnSIP parameter resized the browser Window to ensure the SIP did not occlude any of your site.  There are a number of difficulties with this such as incompatibilities with some variants of CE, and not being able to move the SIP.  Several versions ago RhoElements introduced work arounds for this specifically the SIP will no longer obscure your webpage's text fields.

By default ResizeOnSIP is disabled (set to '0').  It is not recommended to change this default setting.

RhoElements_Icon_TB.jpg

profile

Anonymous (not verified)

Please Register or Login to post a reply

Replies