@@ -4,39 +4,38 @@ import {withLoading} from "../../utils/loading";
4
4
import {GraphData , GraphKind , GraphsSelector } from " ./state" ;
5
5
import {GRAPH_DATA_URL } from " ../../urls" ;
6
6
import DataSelector , {SelectionParams } from " ./data-selector.vue" ;
7
- import {getUrlParams } from " ../../utils/navigation" ;
7
+ import {createUrlWithAppendedParams , getUrlParams , navigateToUrlParams } from " ../../utils/navigation" ;
8
8
import {renderPlots } from " ./plots" ;
9
- import {createUrlParams , navigateToUrlParams } from " ../../utils/navigation" ;
10
9
import {getJson } from " ../../utils/requests" ;
11
10
import {BenchmarkInfo , loadBenchmarkInfo } from " ../../api" ;
12
11
import AsOf from " ../../components/as-of.vue" ;
13
12
14
13
function loadSelectorFromUrl(urlParams : Dict <string >): GraphsSelector {
15
- const start = urlParams [" start" ] ?? " " ;
16
- const end = urlParams [" end" ] ?? " " ;
17
- const kind: GraphKind = urlParams [" kind" ] as GraphKind ?? " raw" ;
18
- const stat = urlParams [" stat" ] ?? " instructions:u" ;
19
- const benchmark = urlParams [" benchmark" ] ?? null ;
20
- const scenario = urlParams [" scenario" ] ?? null ;
21
- const profile = urlParams [" profile" ] ?? null ;
22
- return {
23
- start ,
24
- end ,
25
- kind ,
26
- stat ,
27
- benchmark ,
28
- scenario ,
29
- profile
30
- };
14
+ const start = urlParams [" start" ] ?? " " ;
15
+ const end = urlParams [" end" ] ?? " " ;
16
+ const kind: GraphKind = urlParams [" kind" ] as GraphKind ?? " raw" ;
17
+ const stat = urlParams [" stat" ] ?? " instructions:u" ;
18
+ const benchmark = urlParams [" benchmark" ] ?? null ;
19
+ const scenario = urlParams [" scenario" ] ?? null ;
20
+ const profile = urlParams [" profile" ] ?? null ;
21
+ return {
22
+ start ,
23
+ end ,
24
+ kind ,
25
+ stat ,
26
+ benchmark ,
27
+ scenario ,
28
+ profile
29
+ };
31
30
}
32
31
33
32
function filterBenchmarks(data : GraphData , filter : (key : string ) => boolean ): GraphData {
34
- const benchmarks = Object .fromEntries (Object .entries (data .benchmarks )
35
- .filter (([key , _ ]) => filter (key )));
36
- return {
37
- ... data ,
38
- benchmarks
39
- };
33
+ const benchmarks = Object .fromEntries (Object .entries (data .benchmarks )
34
+ .filter (([key , _ ]) => filter (key )));
35
+ return {
36
+ ... data ,
37
+ benchmarks
38
+ };
40
39
}
41
40
42
41
/*
@@ -45,11 +44,11 @@ function filterBenchmarks(data: GraphData, filter: (key: string) => boolean): Gr
45
44
* will not be shown.
46
45
*/
47
46
function hasSpecificSelection(selector : GraphsSelector ): boolean {
48
- return (
49
- selector .benchmark !== null ||
50
- selector .profile !== null ||
51
- selector .scenario !== null
52
- );
47
+ return (
48
+ selector .benchmark !== null ||
49
+ selector .profile !== null ||
50
+ selector .scenario !== null
51
+ );
53
52
}
54
53
55
54
async function loadGraphData(selector : GraphsSelector , loading : Ref <boolean >) {
@@ -61,42 +60,42 @@ async function loadGraphData(selector: GraphsSelector, loading: Ref<boolean>) {
61
60
stat: selector .stat ,
62
61
benchmark: selector .benchmark ,
63
62
scenario: selector .scenario ,
64
- profile: selector .profile ,
63
+ profile: selector .profile
65
64
};
66
65
return await getJson <GraphData >(GRAPH_DATA_URL , params );
67
66
});
68
67
69
- // Wait for the UI to be updated, which also resets the plot HTML elements.
70
- // Then draw the plots.
71
- await nextTick ();
68
+ // Wait for the UI to be updated, which also resets the plot HTML elements.
69
+ // Then draw the plots.
70
+ await nextTick ();
72
71
73
- // If we select a smaller subset of benchmarks, then just show them.
74
- if (hasSpecificSelection (selector )) {
75
- renderPlots (graphData , selector , " #charts" );
76
- } else {
77
- // If we select all of them, we expect that there will be a regular grid.
72
+ // If we select a smaller subset of benchmarks, then just show them.
73
+ if (hasSpecificSelection (selector )) {
74
+ renderPlots (graphData , selector , " #charts" );
75
+ } else {
76
+ // If we select all of them, we expect that there will be a regular grid.
78
77
79
- // So, first render everything but the less important benchmarks about artifact sizes.
80
- // This keeps the grouping and alignment of 4 charts per row where all 4 charts are about a
81
- // given benchmark. So, we exclude the benchmarks ending in "-tiny".
82
- const withoutTiny = filterBenchmarks (graphData , (benchName ) => ! benchName .endsWith (" -tiny" ));
83
- renderPlots (withoutTiny , selector , " #charts" );
78
+ // So, first render everything but the less important benchmarks about artifact sizes.
79
+ // This keeps the grouping and alignment of 4 charts per row where all 4 charts are about a
80
+ // given benchmark. So, we exclude the benchmarks ending in "-tiny".
81
+ const withoutTiny = filterBenchmarks (graphData , (benchName ) => ! benchName .endsWith (" -tiny" ));
82
+ renderPlots (withoutTiny , selector , " #charts" );
84
83
85
- // Then, render only the size-related ones in their own dedicated section as they are less
86
- // important than having the better grouping. So, we only include the benchmarks ending in
87
- // "-tiny" and render them in the appropriate section.
88
- const onlyTiny = filterBenchmarks (graphData , (benchName ) => benchName .endsWith (" -tiny" ));
89
- renderPlots (onlyTiny , selector , " #size-charts" );
90
- }
84
+ // Then, render only the size-related ones in their own dedicated section as they are less
85
+ // important than having the better grouping. So, we only include the benchmarks ending in
86
+ // "-tiny" and render them in the appropriate section.
87
+ const onlyTiny = filterBenchmarks (graphData , (benchName ) => benchName .endsWith (" -tiny" ));
88
+ renderPlots (onlyTiny , selector , " #size-charts" );
89
+ }
91
90
}
92
91
93
92
function updateSelection(params : SelectionParams ) {
94
- navigateToUrlParams (createUrlParams ({
93
+ navigateToUrlParams (createUrlWithAppendedParams ({
95
94
start: params .start ,
96
95
end: params .end ,
97
96
kind: params .kind ,
98
97
stat: params .stat
99
- }));
98
+ }). searchParams );
100
99
}
101
100
102
101
const info: BenchmarkInfo = await loadBenchmarkInfo ();
@@ -134,9 +133,9 @@ loadGraphData(selector, loading);
134
133
</div >
135
134
<a href =" https://github.com/rust-lang-nursery/rustc-perf" >
136
135
<img
137
- style =" position : absolute ; top : 0 ; right : 0 ; border : 0 ; clip-path : polygon (8% 0% , 100% 92% , 100% 0% );"
138
- src =" https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
139
- alt =" Fork me on GitHub"
140
- data-canonical-src =" https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" >
136
+ style =" position : absolute ; top : 0 ; right : 0 ; border : 0 ; clip-path : polygon (8% 0% , 100% 92% , 100% 0% );"
137
+ src =" https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
138
+ alt =" Fork me on GitHub"
139
+ data-canonical-src =" https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" >
141
140
</a >
142
141
</template >
0 commit comments