Any ideas about wxMSW Win32 inefficiency (and related bugs)?

63 views
Skip to first unread message

RigoLigo

unread,
Nov 13, 2024, 3:16:13 AM11/13/24
to KiCad Developer Mailing List

Hello fellow devs,

Over the years dealing with GUI of KiCad, I believe most users on Windows experienced significant delays when opening (and closing) dialogs. And that part is already affecting the experience a lot: opening the Board Setup dialog from Pcbnew takes more than 1 second on my Ryzen 9 workstation (!!), while on my M1 MacBook Air it's about half a second.

A quick survey in our Chinese community chat reveals that 40% users experience 2~5 seconds of delay (their processors ranging from 4th-gen Core i5 to  Ryzen 7 8845H); more than 60% users would feel Windows version had a longer delay than other platforms.

I made a local build of master branch, and profiled the execution while opening and closing Board Setup 5 times in a row.
VS Profiler reveals that 61.24% of CPU time is consumed in unknown code that resides in kernel space (Win32K.sys, syscall processing code, etc), and 13.85% CPU time is used on win32u. Only ~13% were actually wxWidgets overhead. With 5730 samples taken at a rate of 1kSa/s, that meant each time I open Board Setup, 1.146s is wasted inside kernel space.

(Third column is the CPU time consumed in a specific function of a module, excluding calls to other functions)

With my knowledge on how Windows works, I would say wxMSW is hugely inefficient due to the fact it utilizes Windows "native" controls from comctl32 and other stuff. This might seem counterintuitive, but Windows apps really suffered from these "native" controls. Each of these controls are Win32 window objects that resides in kernel space, and any manipulation on them require at least a syscall. And due to the fact that kernel always take extra care checking userspace data, plus address space switching overhead, eventually made our dialog performance a lot worse than other platforms.

I am aware that we probably should focus more on feature parity with mature tools rather than UI framework. However wxMSW has constantly been an issue (lack of dark mode support, IME hang bug, a mysterious "toolbar icons collapsing into a thin piece" bug in Chinese community that can't be stably reproduced but occurs on many people's machines), and I'm curious what we can do about the wxMSW situation (maybe use GTK on Windows?).


Rigo

Jon Evans

unread,
Nov 13, 2024, 8:22:27 AM11/13/24
to dev...@kicad.org
Hi Rigo,

Can you try disabling the section of DIALOG_BOARD_SETUP that creates PANEL_SETUP_BOARD_STACKUP?
I am curious how much this particular tab contributes to the time.  It creates a lot of controls dynamically.

About your other Windows complaints:  Dark mode is coming in wx 3.3 -- is the "toolbar icons collapsing" bug already reported somewhere?
For the IME issue I guess we should follow up on https://github.com/wxWidgets/wxWidgets/issues/24558

-Jon

--
You received this message because you are subscribed to the Google Groups "KiCad Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to devlist+u...@kicad.org.
To view this discussion visit https://groups.google.com/a/kicad.org/d/msgid/devlist/3d909c69-792d-4436-b23f-45bc01c93466%40gmail.com.

Graham Keeth

unread,
Nov 13, 2024, 8:26:44 AM11/13/24
to dev...@kicad.org
Reply all
Reply to author
Forward
0 new messages