W3C home > Mailing lists > Public > public-device-apis@w3.org > June 2013

[vibration] Reordered steps 3 and 5 for better performance

From: Kostiainen, Anssi <anssi.kostiainen@intel.com>
Date: Wed, 12 Jun 2013 17:56:58 +0000
To: "<public-device-apis@w3.org>" <public-device-apis@w3.org>
Message-ID: <14378D01-8FAF-459D-BA8F-AD82D1028F79@intel.com>
Hi,

I reordered the steps 3 and 5 [1] in the 'processing vibration patterns' algorithm [2] to perform the likely cheaper operation first. Checking the length of the pattern is probably cheaper than checking the length of each entry, thus it makes sense to do the cheaper operation first.

The new order:

[[

3. If the length of pattern exceeds an implementation-dependent limit, then return false and terminate these steps.

[...]

5. If any entry of pattern exceeds an implementation-dependent limit, then return false and terminate these steps.

]]

-Anssi

[1] http://dev.w3.org/cvsweb/2009/dap/vibration/Overview.src.html.diff?r1=1.4;r2=1.5;f=h
[2] http://dev.w3.org/2009/dap/vibration/#dfn-processing-vibration-patterns
Received on Wednesday, 12 June 2013 17:57:35 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:53:59 UTC