Skip to content

Use obs::fast_signal by default for better performance and smaller widgets#5703

Merged
dacap merged 1 commit into
aseprite:betafrom
dacap:fast-signals
Mar 16, 2026
Merged

Use obs::fast_signal by default for better performance and smaller widgets#5703
dacap merged 1 commit into
aseprite:betafrom
dacap:fast-signals

Conversation

@dacap

@dacap dacap commented Mar 10, 2026

Copy link
Copy Markdown
Member

This patch makes obs::signal = obs::fast_signal (before it was obs::safe_signal).

The new obs::fast_signal is smaller (just a std::vector instead of mutexes/conditional_variables, etc.) and when it's iterated a copy of the vector is created (we need this because there are some cases where a connection/slot is disconnected in the same signal).

It's here just to give a general look, not sure if there are some signal that might need to be converted to obs::safe_signal (e.g. if the signal is used between multiple threads).

…dgets

E.g.         safe_signal -> fast_signal
sizeof(Widget)     = 544 -> 384 bytes
sizeof(ButtonBase) = 800 -> 480
sizeof(Entry)      = 776 -> 536
sizeof(ComboBox)   = 976 -> 576
sizeof(LinkLabel)  = 760 -> 520
sizeof(Menu)       = 672 -> 432
sizeof(MenuItem)   = 696 -> 456
sizeof(Window)     = 968 -> 568

@ckaiser ckaiser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I added some asserts inside the signals and slots to make sure we weren't accidentally using them inside multiple threads and then ran some tests and did some manual normal use just to make sure and this feels pretty safe.

@ckaiser ckaiser assigned dacap and unassigned ckaiser Mar 13, 2026
@dacap dacap merged commit 43ea80a into aseprite:beta Mar 16, 2026
11 checks passed
@dacap dacap deleted the fast-signals branch March 16, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants