My Automation script running very slow on mobile devices as compare to the desktop

My script taking to much time in execution on mobile
so some time we are facing timeout in case of mobile device.
it take around 4x more time than desktop.
can i have any solution fro this issue?

Do you use iOS or Android?

I am using both android and IOS in parallel and dunning through Mac OS.

iOS have an inbuilt delay of 1 second between each request/command. So running on simulator will be faster in every case.
Beside this, avoid using the xpath locator and go for accessibilityIDs to speed up your automation.
On iOS try using the iosUIAutomation for iOS 9.3 and below and the iosPredicates for iOS 10 and above.
With android I do not have any experience, sry

Following are my few observation while running your scripts faster in Android device -

  1. Avoid using xpaths, use ID, Name or ClassName(if it’s unique).
  2. Use ADB command whenever it is needed - i.e; if you want to clear text, rather than clearing it through appium, try using adb commands, same way goes with enter text.) This will reduce your time drastically.
  3. Use device keyboard to enter PIN or something while logging in.
  4. Always provide devicename in your capabilities, always fire adb commands with your device name.
  5. Use softwaits and element present everywhere you see any element.
  6. Try not to close application unless it is required.
  7. Internet connection should be on high speed.

Let me know these steps fastens your execution.