calabash / calabash-android

Automated Functional testing for Android using cucumber
Other
1.68k stars 617 forks source link

HTTP request for Gestures significantly slower on Android 8.0 #864

Open ashtonlouie opened 6 years ago

ashtonlouie commented 6 years ago

Hi,

I recently started supporting an Android 8.0 device in my project and I noticed my test execution time was significantly slower on this new phone. After some digging I narrowed down the bottleneck to be the HTTP request sent for gesture commands.

This is the flick gesture I am using:

=> #<Calabash::Android::Gestures::MultiTouchGesture:0x00007fe5fd4a7cd0
 @gestures=
  [#<Calabash::Android::Gestures::Gesture:0x00007fe5fd4a7eb0
    @query_string="* id:'content'",
    @touches=
     [#<Calabash::Android::Gestures::Touch:0x00007fe5fd4a7e60
       @offset_x=0,
       @offset_y=0,
       @query_string=nil,
       @release=false,
       @time=0.2,
       @wait=0.0,
       @x=2,
       @y=45>,
      #<Calabash::Android::Gestures::Touch:0x00007fe5fd4a7d98
       @offset_x=0,
       @offset_y=0,
       @query_string=nil,
       @release=true,
       @time=0.0,
       @wait=0.0,
       @x=2,
       @y=10>]>],

And my gesture execution (where g is my Gesture object):

JSON.parse(http("/gesture", JSON.parse(g.to_json), read_timeout: g.timeout+10))

Running through Benchmark with Android 8.0 I see a typical result like this:

=> #<Benchmark::Tms:0x00007ff3c7ed6aa8
 @cstime=0.0,
 @cutime=0.0,
 @label="",
 @real=0.5260619999608025,
 @stime=0.0009970000000000256,
 @total=0.002767000000000075,
 @utime=0.0017700000000000493>

On my other Android devices (ranging from Android 4.2.2 to Android 7.0) my average execution time is around 0.3 seconds, rather than the ~0.5 seconds seen here with Android 8.0. I've tested this against multiple devices I have available, different networks, and even different apps, and observed similar behavior.

Over the course of a long test execution, this extra time for every gesture has significantly increased my execution time for Android 8.0. If anyone has any ideas that may help it would be greatly appreciated! Thanks.

john7doe commented 6 years ago

Hi,

Thanks for reporting. I recently did some performance work for queries on newer android devices. (https://github.com/calabash/calabash-android-server/pull/54) The code has been merged to master, but no release has been made yet.

The changes will most likely improve performance of the gesture endpoint.

Br, /Simon