Commit 0e8a5af
Brian Vaughn
Scheduling Profiler: Add marks for component effects (mount and unmount) (#22578)
DevTools (and its profilers) should not require users to be familiar with React internals. Although the scheduling profiler includes a CPU sample flame graph, it's there for advanced use cases and shouldn't be required to identify common performance issues.
This PR proposes adding new marks around component effects. This will enable users to identify components with slow effect create/destroy functions without requiring them to dig through the call stack. (Once #22529 lands, these new marks will also include component stacks, making them more useful still.)
For example, here's a profile with a long-running effect. Without this change, it's not clear why the effects phase takes so long. After this change, it's more clear why that the phase is longer because of a specific component.
We may consider adding similar marks around render phase hooks like useState, useReducer, useMemo. I avoided doing that in this PR because it would be a pretty pervasive change to the ReactFiberHooks file.
Note that this change should have no effect on production bundles since everything is guarded behind a profiling feature flag.
Going to tag more people than I normally would for this pR, since it touches both reconciler and DevTools packages. Feel free to ignore though if you don't have strong feelings.
Note that although this PR adds new marks to the scheduling profiler, it's done in a way that's backwards compatible for older profiles.1 parent 4ba2057 commit 0e8a5af
File tree
10 files changed
+649
-127
lines changed- packages
- react-devtools-scheduling-profiler/src
- content-views
- import-worker
- __tests__
- react-reconciler/src
- __tests__
10 files changed
+649
-127
lines changedLines changed: 19 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
146 | 163 | | |
147 | 164 | | |
148 | 165 | | |
| |||
Lines changed: 51 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
| |||
96 | 102 | | |
97 | 103 | | |
98 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
102 | 111 | | |
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
109 | 152 | | |
110 | 153 | | |
111 | 154 | | |
| |||
114 | 157 | | |
115 | 158 | | |
116 | 159 | | |
117 | | - | |
| 160 | + | |
118 | 161 | | |
119 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
120 | 165 | | |
121 | 166 | | |
122 | 167 | | |
| |||
Lines changed: 0 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | 62 | | |
65 | 63 | | |
66 | 64 | | |
| |||
150 | 148 | | |
151 | 149 | | |
152 | 150 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | 151 | | |
160 | 152 | | |
161 | 153 | | |
| |||
Lines changed: 39 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
840 | 840 | | |
841 | 841 | | |
842 | 842 | | |
843 | | - | |
| 843 | + | |
844 | 844 | | |
845 | 845 | | |
846 | 846 | | |
| |||
852 | 852 | | |
853 | 853 | | |
854 | 854 | | |
855 | | - | |
| 855 | + | |
856 | 856 | | |
857 | 857 | | |
858 | 858 | | |
859 | | - | |
| 859 | + | |
860 | 860 | | |
861 | 861 | | |
862 | 862 | | |
| |||
866 | 866 | | |
867 | 867 | | |
868 | 868 | | |
869 | | - | |
| 869 | + | |
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
875 | | - | |
| 875 | + | |
876 | 876 | | |
877 | 877 | | |
878 | 878 | | |
879 | | - | |
| 879 | + | |
880 | 880 | | |
881 | 881 | | |
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
885 | | - | |
| 885 | + | |
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
889 | | - | |
| 889 | + | |
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
893 | 893 | | |
894 | 894 | | |
895 | | - | |
| 895 | + | |
896 | 896 | | |
897 | 897 | | |
898 | 898 | | |
899 | | - | |
| 899 | + | |
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
| |||
906 | 906 | | |
907 | 907 | | |
908 | 908 | | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
909 | 917 | | |
910 | 918 | | |
911 | 919 | | |
912 | 920 | | |
913 | 921 | | |
914 | | - | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
915 | 931 | | |
916 | 932 | | |
917 | 933 | | |
918 | | - | |
| 934 | + | |
919 | 935 | | |
920 | 936 | | |
921 | 937 | | |
| |||
1000 | 1016 | | |
1001 | 1017 | | |
1002 | 1018 | | |
1003 | | - | |
| 1019 | + | |
1004 | 1020 | | |
1005 | 1021 | | |
1006 | 1022 | | |
| |||
1010 | 1026 | | |
1011 | 1027 | | |
1012 | 1028 | | |
1013 | | - | |
| 1029 | + | |
1014 | 1030 | | |
1015 | 1031 | | |
1016 | 1032 | | |
1017 | | - | |
| 1033 | + | |
1018 | 1034 | | |
1019 | 1035 | | |
1020 | 1036 | | |
| |||
1024 | 1040 | | |
1025 | 1041 | | |
1026 | 1042 | | |
1027 | | - | |
| 1043 | + | |
1028 | 1044 | | |
1029 | 1045 | | |
1030 | 1046 | | |
1031 | 1047 | | |
1032 | 1048 | | |
1033 | | - | |
| 1049 | + | |
1034 | 1050 | | |
1035 | 1051 | | |
1036 | 1052 | | |
1037 | | - | |
| 1053 | + | |
1038 | 1054 | | |
1039 | 1055 | | |
1040 | 1056 | | |
1041 | 1057 | | |
1042 | 1058 | | |
1043 | | - | |
| 1059 | + | |
1044 | 1060 | | |
1045 | 1061 | | |
1046 | 1062 | | |
1047 | | - | |
| 1063 | + | |
1048 | 1064 | | |
1049 | 1065 | | |
1050 | 1066 | | |
1051 | 1067 | | |
1052 | 1068 | | |
1053 | | - | |
| 1069 | + | |
1054 | 1070 | | |
1055 | 1071 | | |
1056 | 1072 | | |
1057 | | - | |
| 1073 | + | |
1058 | 1074 | | |
1059 | 1075 | | |
1060 | 1076 | | |
| |||
1108 | 1124 | | |
1109 | 1125 | | |
1110 | 1126 | | |
1111 | | - | |
| 1127 | + | |
1112 | 1128 | | |
1113 | 1129 | | |
1114 | 1130 | | |
| |||
0 commit comments