Performance issues with Undo / Redo

Dear Sketch Team,
Please look at the Undo/Redo functionality on the large-size files. I had a situation where I had to Undo and then Redo 50+ steps, and after that, I had to kill the Sketch app because it was not functioning on my machine correctly. On Activity Monitor, it shows it consumes over 190% of my CPU when I’m not doing anything for over 5 minutes.

Apple M2 Max 32 GB

Hi @Paulius , thanks for sharing this report. We have two things here, so I’ll go through each one separately:

1-Undo and performance
Can you share with us a copy of your file to File size plays a part but also the nature of the steps you’re undoing: undoing layer movement is different from undoing a boolean operation, drawing paths or inserting components from libraries.

Undoing 50+ steps and then redoing them seems quite a lot. I was wondering if reverting to a previous version of your file could be better than going back 50+ steps :thinking:

2-CPU usage while Sketch is idle
If CPU usage remained high while the app was apparently idle, it’s very likely that there was some processing still going on. If this happened right after undoing the 50+ steps, it’s likely that the app was still processing those undos.

For example, I have a M1 MacBook Air, 8GB, nothing fancy :sweat_smile: and Sketch is at 1 or 2% CPU when idle. When I work on files, CPU usage goes up, but it stabilizes and then it comes down.

If you keep experiencing this high CPU usage when idle, please let me know and I can follow up on that as well.

190% is less than 25% of your performance core allowance, and less than 17% of your total CPU allowance. By itself, it shouldn’t indicate a problem at all.

However, sustained core usage at that level after 5 idle minutes to me suggests that a process was hanging. Probably a bug, as reported.

It’s very easy to perform many hundreds, or thousands, of action that don’t warrant activating version control.

@Phy Yes, the process hangs up, and the Sketch app becomes unresponsive or very slow afterward. I usually save the file on M1 Mini before trying to undo many steps because it usually results in a frozen app. With M2 Max, it’s a bit better, and I can undo and redo, but I will need to wait at least 3+ minutes for the app to recover, but that is not always the case. After recovery, the app tends to be sluggish, and I would typically restart it to ensure I don’t have issues with performance later when working on the same file.

@dfmedrano Unfortunately, I can’t share the file since this is a work-in-progress document. Perhaps you can ask your internal designer to undo/redo 50+ steps to see the effect after working on a large cloud file for an hour or more.

Yeah that’s nuts.

Hey @Paulius, thanks for the extra info about the issue you’re experiencing. Since you cannot share the Document with us, would it be possible for you to collect some logs that our team can use to understand a bit of where the issue might be coming from?

Please follow the instructions to collect a sample log:

  • Quit Sketch if you have it open
  • Open Terminal (⌘ Command + Space → write “Terminal” → press Enter)
  • Copy and paste this command in Terminal: sample Sketch 20 -wait -mayDie -file ~/Desktop/SketchSample-$(date "+%Y-%m-%d_%H.%M.%S").txt
  • Press Enter to execute it.
  • Open Sketch and try to replicate the issue.
  • Done!

The script above will create a new .txt file on your Desktop. The script will run for about 20s, if you need more time, you can adjust the parameter on the command above, and adjust that to a higher number in order to have enough time to replicate the issue.


1 Like

@raulrincon it’s asking me to select PID or letter, but I’m not able to select. Can you let me know what I’m doing wrong? Thanks

Hey, thanks for the reply!

In this case, you’d have to type a and press Enter, as the process of Sketch is tied to the a letter.