← Back to team overview

sikuli-driver team mailing list archive

[Bug 1241993] Re: [1.0.1] Region exists(..., 0) failing does not return instantly with scan rates > 1

 

Looks good to me. I would have added parenthesis around timeout * 1000
to handle timeouts below 1s.

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1241993

Title:
  [1.0.1] Region exists(..., 0) failing does not return instantly with
  scan rates > 1

Status in Sikuli:
  Fix Committed

Bug description:
  Version: 1.0.1
  64-bit

  Procedure: I look for a Pattern myPattern that is NOT in the Region myRegion. The size of the pattern (+similarity) and the region are irrelevant. 
  Expected behavior: The exists/find should return immediately. 
  Observed behavior: That is not always the case, there is some delay (up to 0.5s) depending on Settings.WaitScanRate.

  
  The code snippet:

  # timer start
  if not myRegion.exists(myPattern, 0):
      #timer end

  Now the result:

  Settings.WaitScanRate = 10
  Duration: 0.1s

  Settings.WaitScanRate = 5
  Duration: 0.2s

  Settings.WaitScanRate = 4
  Duration: 0.25s

  Settings.WaitScanRate = 3
  Duration: 0.33s (default setting... this is a significant delay)

  Settings.WaitScanRate = 2
  Duration: 0.5s 

  Settings.WaitScanRate = 1
  Duration: 0.03s

  Settings.WaitScanRate = 0.5
  Duration: 0.03s

  Settings.WaitScanRate = 0.1
  Duration: 0.03s (seems the minimal one can reach on that operation)
  ...

  __________

  Bug location:
  http://bazaar.launchpad.net/~raimund-hocke/sikuli/sikuli-api/view/head:/src/main/java/org/sikuli/script/Region.java#L1879

  #L1881 int MaxTimePerScan = (int) (1000.0 / waitScanRate);
  #L1882 int MaxTimePerScanSecs = MaxTimePerScan / 1000;
  MaxTimePerScanSecs is equal to 0 when waitScanRate is strictly higher to 1, integer division rules in java...

  #L1890  if (timeout < MaxTimePerScanSecs)
  This is false (assuming timeout is 0), and additional delay ensue...

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1241993/+subscriptions


References