Skip to content

build: make enableComponentPerformanceTrack dynamic for native-fb #33560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

hoxyq
Copy link
Contributor

@hoxyq hoxyq commented Jun 18, 2025

Summary

Make this flag dynamic, so it can be controlled internally.

How did you test this change?

Build, observe that console.timeStamp is only present in FB artifacts and enableComponentPerformanceTrack is referenced.

@react-sizebot
Copy link

react-sizebot commented Jun 18, 2025

Comparing: e1dc034...9aa04f7

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 530.57 kB 530.57 kB = 93.67 kB 93.67 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 651.66 kB 651.66 kB = 114.78 kB 114.78 kB
facebook-www/ReactDOM-prod.classic.js = 674.81 kB 674.81 kB = 118.78 kB 118.78 kB
facebook-www/ReactDOM-prod.modern.js = 665.30 kB 665.30 kB = 117.19 kB 117.19 kB
react-native/implementations/ReactNativeRenderer-profiling.fb.js +9.49% 414.99 kB 454.37 kB +6.73% 70.92 kB 75.70 kB
react-native/implementations/ReactFabric-profiling.fb.js +9.49% 415.20 kB 454.59 kB +6.84% 70.95 kB 75.80 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js +8.26% 680.02 kB 736.15 kB +5.94% 110.23 kB 116.77 kB
react-native/implementations/ReactFabric-dev.fb.js +8.21% 678.38 kB 734.08 kB +5.97% 110.01 kB 116.58 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-profiling.js +6.71% 605.49 kB 646.14 kB +4.84% 105.83 kB 110.95 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-profiling.js +6.65% 611.43 kB 652.08 kB +4.79% 106.97 kB 112.09 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-dev.js +5.58% 1,036.98 kB 1,094.82 kB +4.06% 174.02 kB 181.09 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-dev.js +5.49% 1,053.25 kB 1,111.09 kB +4.00% 176.83 kB 183.90 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
react-native/implementations/ReactNativeRenderer-profiling.fb.js +9.49% 414.99 kB 454.37 kB +6.73% 70.92 kB 75.70 kB
react-native/implementations/ReactFabric-profiling.fb.js +9.49% 415.20 kB 454.59 kB +6.84% 70.95 kB 75.80 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js +8.26% 680.02 kB 736.15 kB +5.94% 110.23 kB 116.77 kB
react-native/implementations/ReactFabric-dev.fb.js +8.21% 678.38 kB 734.08 kB +5.97% 110.01 kB 116.58 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-profiling.js +6.71% 605.49 kB 646.14 kB +4.84% 105.83 kB 110.95 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-profiling.js +6.65% 611.43 kB 652.08 kB +4.79% 106.97 kB 112.09 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-dev.js +5.58% 1,036.98 kB 1,094.82 kB +4.06% 174.02 kB 181.09 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-dev.js +5.49% 1,053.25 kB 1,111.09 kB +4.00% 176.83 kB 183.90 kB

Generated by 🚫 dangerJS against 9aa04f7

@@ -26,3 +26,4 @@ export const passChildrenWhenCloningPersistedNodes = __VARIANT__;
export const enableLazyPublicInstanceInFabric = __VARIANT__;
export const renameElementSymbol = __VARIANT__;
export const enableFragmentRefs = __VARIANT__;
export const enableComponentPerformanceTrack = __VARIANT__;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be __PROFILE__ && __VARIANT__ so we can enable the feature in dev and profiling, but the code is never included in release builds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that sounds reasonable.

Right now it still compiles out everything what's gated under enableComponentPerformanceTrack, so production artifacts don't have references to it or console.timeStamp. enableComponentPerformanceTrack is a subset of enableProfilerTimer, which already gated under __PROFILE__:

// Gather advanced timing metrics for Profiler subtrees.
export const enableProfilerTimer = __PROFILE__;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to this to make Flow happy:

export const enableComponentPerformanceTrack: boolean =
__PROFILE__ && dynamicFlags.enableComponentPerformanceTrack;

@hoxyq hoxyq force-pushed the make-perf-tracks-dynamic-for-native-fb branch 2 times, most recently from 22664b2 to 8f217ff Compare June 18, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants