File tree Expand file tree Collapse file tree 4 files changed +73
-0
lines changed
Expand file tree Collapse file tree 4 files changed +73
-0
lines changed Original file line number Diff line number Diff line change 3030< li > < a href ="many-redirects/index.html "> many-redirects</ a > </ li >
3131< li > < a href ="minified-with-source-maps/index.html "> minified-with-source-maps</ a > </ li >
3232< li > < a href ="nested-interactions/index.html "> nested-interactions</ a > </ li >
33+ < li > < a href ="nested-user-timings/index.html "> nested-user-timings</ a > </ li >
3334< li > < a href ="node-fib-app/index.html "> node-fib-app</ a > </ li >
3435< li > < a href ="react-hello-world/index.html "> react-hello-world</ a > </ li >
3536< li > < a href ="scheduler/index.html "> scheduler</ a > </ li >
Original file line number Diff line number Diff line change 1+ # user-timings
2+
3+ This example creates some performance measures:
4+
5+ 1 . ` first measure ` from 0-200ms
6+ 2 . ` second measure ` from 0-600ms
7+ 3 . ` third measure ` from 1000-2000ms
Original file line number Diff line number Diff line change 1+ function consecutiveNonOverlapping ( ) {
2+ const name = 'ConsecutiveNonOverlapping' ;
3+ const start = performance . now ( ) ;
4+
5+ performance . measure ( name , {
6+ start : start ,
7+ end : start + 500 ,
8+ } ) ;
9+ performance . measure ( name , {
10+ start : start + 500 ,
11+ end : start + 1000 ,
12+ } ) ;
13+ }
14+
15+ function overlappingNonNested ( ) {
16+ const name = 'OverlappingNonNested' ;
17+ const start = performance . now ( ) ;
18+
19+ performance . measure ( name , {
20+ start : start ,
21+ end : start + 500 ,
22+ } ) ;
23+ performance . measure ( name , {
24+ start : start + 100 ,
25+ end : start + 600 ,
26+ } ) ;
27+ }
28+
29+ function overlappingNested ( ) {
30+ const name = 'OverlappingNested' ;
31+ const start = performance . now ( ) ;
32+
33+ performance . measure ( name , {
34+ start : start ,
35+ end : start + 500 ,
36+ } ) ;
37+ performance . measure ( name , {
38+ start : start + 100 ,
39+ end : start + 200 ,
40+ } ) ;
41+ }
42+
43+ setTimeout ( ( ) => {
44+ consecutiveNonOverlapping ( ) ;
45+ } , 100 ) ;
46+
47+ setTimeout ( ( ) => {
48+ overlappingNonNested ( ) ;
49+ } , 2000 ) ;
50+
51+ setTimeout ( ( ) => {
52+ overlappingNested ( ) ;
53+
54+ const text = document . createTextNode ( 'Finished!' ) ;
55+ document . body . appendChild ( text ) ;
56+ } , 3000 ) ;
Original file line number Diff line number Diff line change 1+ < html >
2+ < head >
3+ < title > User Timings</ title >
4+ < style > </ style >
5+ </ head >
6+ < body >
7+ < script src ="app.js "> </ script >
8+ </ body >
9+ </ html >
You can’t perform that action at this time.
0 commit comments