Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17146] Android: $.theWindow.size execution time depends on something

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.3
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterFix Please
AssigneeUnknown
Created2014-05-03T13:53:21.000+0000
Updated2018-02-28T20:03:44.000+0000

Description

Time of taking window size depends on something and varies from (<=1) millisecond and up to tens of milliseconds. See the attached screenshots.
<Alloy>
  <Window id="theWindow" class="container">
    <Label id="label1" left="10" top="10">0.0</Label>
    <Label id="label2" left="10" top="30">Interval: 0.0 ms</Label>
    
    <Button left="70" top="50" onClick="onButton">Change Interval</Button>
  </Window>     
</Alloy>
$.theWindow.open();

var interval = 100;

function step() {
  var beginTime = new Date().getTime();
  /////
  var size = $.theWindow.size;
  /////  
  var endTime = new Date().getTime();
  
  var executionTime = endTime - beginTime;
  $.label1.setText(executionTime);  
}

var timerId1 = setInterval(step, interval);

function updateLabel() {
  $.label2.setText('Interval: ' + interval + ' ms');
}

var timerId = setInterval(updateLabel, interval);

function onButton() {
  if (interval == 100) {
    interval = 1;
  }
  else if (interval == 1) {
    interval = 10;
  }
  else {
    interval = 100;
  }
  
  clearInterval(timerId);
  timerId = setInterval(updateLabel, interval);
}

Attachments

FileDateSize
interval1_1.png2014-05-03T13:53:21.000+000012894
interval1_2.png2014-05-03T13:53:21.000+000012921
interval1_3.png2014-05-03T13:53:21.000+000012633
interval10_1.png2014-05-03T13:53:22.000+000013159
interval10_2.png2014-05-03T13:53:22.000+000012899
interval10_3.png2014-05-03T13:53:22.000+000012806
interval100_1.png2014-05-03T13:53:21.000+000010741
interval100_2.png2014-05-03T13:53:21.000+000010854

Comments

  1. Ritu Agrawal 2014-06-12

    Moving this ticket to engineering as I can reproduce the timing behavior with the provided test case, as described in this ticket.

JSON Source