Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: New Mask Editor has terrible mouse lag while moving cursor in paint zone. #1851

Open
StDiffusionKnight opened this issue Dec 9, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@StDiffusionKnight
Copy link

StDiffusionKnight commented Dec 9, 2024

Frontend Version

Latest

Expected Behavior

smooth mouse cursor

Actual Behavior

laggy mouse cursor

Steps to Reproduce

Create a new workspace - with updated to latest frontend - paste image - right click - Open in Mask Editor - try to move a mouse in paint area. Then go to settings Mask Editor - Turn Old Version - select image - right click - Open in Mask Editor - try to move a mouse in paint area. There will be huge difference.

Debug Logs

none

Browser Logs

none

Setting JSON

all default - except using latest frontend

What browsers do you use to access the UI ?

Google Chrome

Other

My guess it's a really terrible idea to use several await in function which is called during mousemove event. Probably that's why I don't see exact slow function execution in performance captured trace.

┆Issue is synchronized with this Notion page by Unito

@trsommer
Copy link
Collaborator

trsommer commented Dec 9, 2024

I'm investigating the issue. The async pulls are not the issue because they're only asynchronous due to the messageBroker object's pull function design. Most of them just retrieve object variables. To be sure, I timed updateBrushPreview with and without the async pulls and got nearly identical completion times. I also implemented some rounding on the variables to optimize calculations, but this doesn't seem to make much difference either. I noticed some improvements in lag spikes, but I'm not sure if it's actually better or just confirmation bias. I will investigate further.

I want to add that I can't reproduce any performance difference that I would describe as huge. I definitely see a performance loss compared to the old mask editor, but at least for me, the difference is not that significant. Could you @StDiffusionKnight share your hardware specifications? How much available RAM do you have? Are you using any Chrome extensions that might impact performance?

@psowa001
Copy link

psowa001 commented Dec 18, 2024

Hi, it is the same for me. I am running ComfyUI using Google Colab with L4 GPU - 23GB of vram and 54GB of ram. See the recording
maskeditor

@LukeG89
Copy link

LukeG89 commented Dec 18, 2024

@trsommer Found the possible culprit: Browser graphics acceleration.
I'm using Chrome with no extensions.

With acceleration on:

On.mp4

With acceleration off:

Off.mp4

Debug logs:

E:\>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --disable-all-custom-nodes --front-end-version Comfy-Org/ComfyUI_frontend@latest
Total VRAM 8192 MB, total RAM 65277 MB
pytorch version: 2.6.0.dev20241216+cu124
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3070 Ti Laptop GPU : cudaMallocAsync
Using pytorch attention
Initializing frontend: Comfy-Org/ComfyUI_frontend@latest, requesting version details from GitHub...
[Prompt Server] web root: E:\ComfyUI\web_custom_versions\Comfy-Org_ComfyUI_frontend\1.6.1
Skipping loading of custom nodes
Starting server

To see the GUI go to: http://127.0.0.1:8188

@huchenlei huchenlei added bug Something isn't working and removed Potential Bug Untriaged bug labels Dec 19, 2024
@benceruleanlu
Copy link
Contributor

benceruleanlu commented Jan 15, 2025

Taking a look at this right now. Can confirm that disabling hardware acceleration on chrome drastically increases cursor latency and lowers fps to undesirable levels.

GPU (1660 super)
image
image

CPU (7700x)
image
image

Attached are my chrome performance profiles.
gpu.json
cpu.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

6 participants