-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New implementation of PerformanceObserver and related APIs (fixes #45122
) (#45206) Summary: Changelog: [internal] (this functionality hasn't been enabled in OSS yet, so no changelog necessary). Fix #45122. performance.mark is currently O(1) but performance.clearMark is O(n) (being n the number of entries in the buffer), which makes this operation very slow. ### Changes overview - Created new `PerformanceEntryBuffer` abstraction with the following subtypes, that differ on how entries are stored: - `PerformanceEntryCircularBuffer` - stores them in a ring buffer that was already implemented, removed key lookup cache (`BoundedConsumableBuffer`) - `PerformanceEntryKeyedBuffer` - stores them in a `unordered_map`, allowing for faster retrieval by type - `PerformanceEntryLinearBuffer` - a simple infinite buffer based on `std::vector`, currently used in a `PerformanceObserver` - Created `PerformanceObserver` abstraction on native side. - Created `PerformanceObserverRegistry` that collects active observers and forwards entries to observers that should retrieve them - Moved some method implementations to `.cpp` files to reduce potential compilation time slowdown. As the `PerformanceEntryReporter` can be included from anywhere in the code, it will be beneficial to make header files as light as possible. - Add comments to methods that note which standard is the method from/for. - Added some `[[nodiscard]]` attributes - Since the logic of routing entries to observers is moved to native side, JS side of the code got much simplified - If ever needed, `PerformanceObserver` can be created from native-side Standards covered: - https://www.w3.org/TR/performance-timeline - https://www.w3.org/TR/event-timing/ - https://w3c.github.io/timing-entrytypes-registry - https://w3c.github.io/user-timing/ Pull Request resolved: #45206 Test Plan: I've tested this e2e on IGVR and in the RNTester playground for the performance APIs. Everything works as expected. There are also new unit tests for this. C++ test results: https://www.internalfb.com/intern/testinfra/testconsole/testrun/8725724513169247/ Reviewed By: rshest Differential Revision: D63101520 Pulled By: rubennorte fbshipit-source-id: 5970b5c14692ff33ffda44a9f09067f6a758bdbe
- Loading branch information
1 parent
94b7793
commit 38b3b21
Showing
35 changed files
with
2,042 additions
and
1,732 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.