Commit Graph

12 Commits

Author SHA1 Message Date
Ruslan Shestopalyuk 09ad0cc0c6 Implement reporting of events from native side to WebPerformance API (#35768)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35768

Changelog: [Internal]

This implements native side mechanics for reporting user events timing to JS  (PerformanceObserver API).

See the standard for more details: https://www.w3.org/TR/event-timing/

The events are only logged when there are any active subscriptions (via `PerformanceObserver.observe`), also we only log "discrete events" (i.e. no likes of mouse move), so the overhead is non-existing.

There are two main metrics of interest for an event lifecycle:
* Time the event is spent in the queue, i.e. the time between it's created and dispatched
* Time that is spend in the event handler on the JS side (event dispatch), or processing time

Both of these are measured, and the corresponding fields are populated.

Reviewed By: sammy-SC

Differential Revision: D42294947

fbshipit-source-id: 4fd7938c04b942400befa4057d4929fb2763cee1
2023-01-03 11:11:37 -08:00
Samuel Susla 51af7cdcde Use nested namespace name
Summary:
changelog: [internal]

Enable two new clang tidy checks:
- modernize-concat-nested-namespaces
- google-build-using-namespace

jest_e2e[run_all_tests]

Reviewed By: rshest

Differential Revision: D40020646

fbshipit-source-id: f3be80b5f829dd0ba376bdd70ed13332e114d48a
2022-10-13 05:07:59 -07:00
Nicola Corti e51e19ecc1 Add event listeners to Scheduler
Summary:
Minimal set of changes to intercept events in external modules. Current intended use-case is for Reanimated to handle events for the Animated properties.

Changelog: [Added] Add listeners to allow intercepting events in C++ core.

Reviewed By: cipolleschi

Differential Revision: D35312534

fbshipit-source-id: ec924b57fd0c0dabf7be7b886dbef23bf3170d6c
2022-04-26 05:11:05 -07:00
Samuel Susla 681ed402de Turning on clang tidy performance-*
Summary:
changelog: [internal]

Enable performance related clang tidy rules.

Reviewed By: javache

Differential Revision: D33350556

fbshipit-source-id: 486446ed0a1ac88af21b691ac6905b4f2359dafc
2022-01-05 05:53:13 -08:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Samuel Susla 5b5ece7980 Clean up unbatched only experiment
Summary:
changelog: [internal]

The experiment isn't shipping.

Reviewed By: JoshuaGross

Differential Revision: D30303379

fbshipit-source-id: 80b89d3738c1640f6abefcad161f95397c88ee04
2021-08-16 04:35:02 -07:00
Samuel Susla 285406103d Introduce EventQueueProcessor
Summary:
Changelog: [internal]

Pulling out event queue processing to its separate class. We will be adding more logic there so it makes sense to separate it for simplicity and testability purposes.

Alternative names that came to mind: `EventsProcessor`, `EventsDispatcher`.

Reviewed By: JoshuaGross

Differential Revision: D28572283

fbshipit-source-id: 1cb2459f616b9995f66da80d50c401e68002da7f
2021-05-25 01:16:04 -07:00
Samuel Susla ffa533a19d Add option to use unbatched queues only
Summary:
Changelog: [internal]

My suggestion is to simplify event dispatching to only two options, synchronous and asynchronous.

Why?
- Fabric has only been using one queue, `AsynchronousBatched`.
- Batching happens even on `AsynchronousUnbatched`. It just batches events until JS thread starts processing them instead of waiting for the main run loop.
- It will make it easier to reason about the code in the future once we start utilising different priorities for Concurrent Mode.

Reviewed By: JoshuaGross

Differential Revision: D28603472

fbshipit-source-id: 14e3a9c15a012c550dc16a044c31d722051a2bdc
2021-05-22 12:19:05 -07:00
Samuel Susla 6468c0a658 Prevent copy of shared_ptr in EventQueue::enqueueEvent
Summary:
Changelog: [internal]

Prevent unnecessary copy of  `RawEvent::eventTarget` which is `shared_ptr` inside `EventQueue::enqueueEvent` by passing in rvalue.

Reviewed By: JoshuaGross

Differential Revision: D28323219

fbshipit-source-id: 7f62e17df5c4264a15adf58f6142155a76de7aae
2021-05-10 16:01:03 -07:00
Samuel Susla 1bafd0086f Remove v1 event coalescing
Summary:
Changelog: [internal]

Old event coalescing isn't used anymore and there haven't been any problems with the new one.

Reviewed By: shergin

Differential Revision: D25701311

fbshipit-source-id: 359f0361edffa22130cfa8322038acdbe26fd599
2021-01-04 04:12:30 -08:00
Samuel Susla 2669118fc8 Make event coalescing more aggressive
Summary:
Changelog: [internal]

Previous implementation of coalescing would only look at the last element in `eventQueue_` and if it was the same type and target, it would coalesce the two together. This was problem when user would scroll in UIScrollView, this triggers onTouchMove and onScroll events at high rates and prevents coalescing of them.

This changes changes the behaviour to search the `eventQueue_` backwards for an event of the same type and target. If one if found, it is moved into its place. If even of another type is found before for the same target, the event is pushed back onto the queue.

Reviewed By: JoshuaGross

Differential Revision: D24992941

fbshipit-source-id: fc1eae4ecd100af6202346674778b0634ed7a15b
2020-11-17 04:21:01 -08:00
David Vacca 1ae76bf0dd Remove inner folders of react/renderer/core
Summary:
This diff removes the inner folder of react/renderer/core, moving all its files into react/renderer/core

This is necessary to simplify the compilation of Fabric in OSS

More details: https://fb.quip.com/amaRA631DX3K

changelog: [internal] Internal

Reviewed By: fkgozali, JoshuaGross

Differential Revision: D22875854

fbshipit-source-id: e2d969c3ec67eab1bbdc9288e5a4285c740fa944
2020-08-01 13:31:03 -07:00