Desktop Automation - execution speed significantly decreases when switching from one window to another

I am automating desktop application using appium, WindowsDriver. In my application on clicking a button, it takes to an another application.

The execution speed significantly decreases when switching from one window to another, despite setting up an automation session for desktop applications and handling window handles.

Any insights or guidance on resolving these challenges would be very helpful.

Adding code used to handle window switch, literally it takes 50 to 60 seconds to click each element after switching to different window (another application)

        //switch to desktop/root Session

        DesiredCapabilities appCapbilities = new DesiredCapabilities();
        appCapbilities.setCapability("app", "Root");
        //desktopSession = new WindowsDriver(new URL("http://127.0.0.1:4723"), appcCpabilities);
        WindowsDriver desktopSession1=null;
        desktopSession1= new WindowsDriver(new URL("http://127.0.0.1:4723/wd/hub"), appCapbilities);
        Thread.sleep(1000);
        String NativeWindowHandle=desktopSession1.findElementByName("element").getAttribute("NativeWindowHandle");
        System.out.println("NativeWindowHandle: "+NativeWindowHandle);
        int natWinHandleInt = Integer.parseInt(NativeWindowHandle);
        String natWinHandleStr = Integer.toHexString(natWinHandleInt);
        String handle="0x"+natWinHandleStr;
        WebDriverWait wait = new WebDriverWait(desktopSession1, 30);
        //switching to different app
        appCapbilities.setCapability("appTopLevelWindow", handle);
        //edgeSession=new WindowsDriver(new URL("http://127.0.0.1:4723"), appCapbilities);
        Thread.sleep(3000);

Is there any way to reduce the time delay?