Closed rubennorte closed 1 month ago
cc @robik :)
@rubennorte Should the refactor keep the API compatibility?
@rubennorte Should the refactor keep the API compatibility?
Yes, that's would be preferred for now.
I think we could use a better API but for the sake of keeping the changes scoped we should address this first.
@rubennorte I managed to refactor this, but not sure how to enable it so I can test it properly 😅 Would simply adding the turbomodule be sufficient?
@rubennorte I managed to refactor this, but not sure how to enable it so I can test it properly 😅 Would simply adding the turbomodule be sufficient?
Yeah, that should suffice. You can include it in react-native/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp
and test the API in RN Tester (Performance API Example).
Description
We have a gated implementation of a new
Performance
API (via the globalperformance
object) andPerformanceObserver
.In this implementation (see
PerformanceEntryReporter
), all performance entries are stored in fixed size circular buffers, which has several problems:performance.clearMarks
is currently anO(n)
operation when given a specific entry name.The second problem is especially relevant in a pattern commonly used to mark points/measures for profiling in the Performance tab without keeping the data in memory for performance observer:
performance.mark
is currentlyO(1)
butperformance.clearMark
isO(n)
(beingn
the number of entries in the buffer), which makes this operation very slow.We should refactor the implementation to:
marks
andmeasures
. We should keep the circular buffer forevent
types, and reduce its size to 150 (as per the spec).React Native Version
0.74.2 / main
Affected Platforms
Runtime - Android, Runtime - iOS, Runtime - Web, Runtime - Desktop
Areas
Bridgeless - The New Initialization Flow, Other (please specify)
Web Convergence