8000 Apple Silicon MacOS getActiveWindowTitle() large latency · Issue #84 · Kalmat/PyWinCtl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Apple Silicon MacOS getActiveWindowTitle() large latency #84
Open
@Sky-Unmodal

Description

@Sky-Unmodal

Following is the code I used in my case:

import pywinctl as pwc
import sys
import time
from pynput import mouse

def on_click(x, y, button, pressed):
     start = time.time()
     if pressed:
         print(f"Mouse button {button} pressed at position ({x}, {y})")
         try:
             print(pwc.getActiveWindow().title)
             print("Latency:",time.time() - start)
         except AttributeError:
             print("No active window")
     else:
         print(f"Mouse button {button} released at position ({x}, {y})")

 with mouse.Listener(on_click=on_click) as listener:
        listener.join()

I ran this on a M1 Macbook pro. The latency is around 400ms to 500ms to just get the active window.

I ran this on another windows machine, the same code gave a latency around 1ms to almost none latency.

May I ask why does the performance vary this much? Or is there something I should do in MacOS for it run smoother?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0