Skip to content

feat(tools-performance): Add subdomains and a metro perfLoggerFactory implementation#4090

Open
JasonVMo wants to merge 5 commits intomainfrom
user/jasonvmo/metro-perf
Open

feat(tools-performance): Add subdomains and a metro perfLoggerFactory implementation#4090
JasonVMo wants to merge 5 commits intomainfrom
user/jasonvmo/metro-perf

Conversation

@JasonVMo
Copy link
Copy Markdown
Collaborator

Description

There are a few main parts to this change:

Subdomain Support

Nothing fancy here, subdomains are just domains that can be enabled by themselves or via the root key. Because the enabled check should be very fast, this just adds the subdomains directly to the enabled set. It also creates a mapping table that allows that to happen in any order. This also adds a registerSubdomain function to allow for callers to set up that association. Note that this will do nothing if perf tracking is not enabled. See the metro implementation for an example.

Metro unstable_perfLoggerFactory Implementation

This adds a create function to create a perf logger factory. It is mainly focused on the wider datasets (tracked by subdomains) and point to point tracking. This uses a new bit of functionality on PerfDomains for starting and finishing an event with a given name. This hooks into whatever strategy is being used (node or timing) and creates single timing entry for the two points.

The perf logger factory will return empty factories if it is not enabled.

Changed the packages from "module" to "commonjs"

While packages on recent versions of node can cleanly interop with ESM packages, given that metro.config.js files are typically CJS and aren't necessarily on the latest node, switching to CJS makes this easier. Making it explicitly "commonjs" rather than removing it removes warnings when running typescript test files directly about ambiguous module systems.

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.

1 participant