Skip to content

Conversation

@j-piasecki
Copy link
Member

@j-piasecki j-piasecki commented Nov 21, 2025

Description

This takes things a step further than #3830.

By wrapping every call to the native module (from V3) with NativeProxy, we have a centralized place that communication with the module always goes through. Using that, most needed operations are batched. The exceptions are updateGestureHandlerConfig (see comment) and createGestureHandler, which needs to run synchronously. This should reduce the amount of unnecessary native calls.

On web, "everything is native" so no batching there. We may investigate the potential gains in the future, but due to differences in scheduling the same approach as on Android/iOS won't work.

I've also changed createGestureHandler on iOS to create the UIGestureRecognizer immediately. This solved a weird "double free" crash I've been seeing.

Test plan

Tested on the same code as #3830

I saw improvements from ~600ms to ~595ms

@j-piasecki j-piasecki force-pushed the @jpiasecki/batch-create-handler branch from 04c9868 to c120837 Compare November 24, 2025 11:23
@j-piasecki j-piasecki changed the title [General] Batch creation of gesture handlers outside of hooks [General] Batch all native operations Nov 24, 2025
@j-piasecki j-piasecki marked this pull request as ready for review November 24, 2025 11:28
@j-piasecki j-piasecki changed the title [General] Batch all native operations [General] Batch native operations Nov 24, 2025
@j-piasecki j-piasecki merged commit 5fb9999 into next Nov 25, 2025
8 of 9 checks passed
@j-piasecki j-piasecki deleted the @jpiasecki/batch-create-handler branch November 25, 2025 14:56
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.

3 participants