@@ -67,11 +67,32 @@ public void benchMarkThroughput(MyState myState, Blackhole blackhole) {
67
67
blackhole .consume (fields );
68
68
}
69
69
70
+ @ Benchmark
71
+ @ BenchmarkMode (Mode .AverageTime )
72
+ @ OutputTimeUnit (TimeUnit .MILLISECONDS )
73
+ public void benchMarkAvgTime_getImmediateFields (MyState myState , Blackhole blackhole ) {
74
+ List <SelectedField > fields = getImmediateFields (myState );
75
+ blackhole .consume (fields );
76
+ }
77
+
78
+ @ Benchmark
79
+ @ BenchmarkMode (Mode .Throughput )
80
+ @ OutputTimeUnit (TimeUnit .MILLISECONDS )
81
+ public void benchMarkThroughput_getImmediateFields (MyState myState , Blackhole blackhole ) {
82
+ List <SelectedField > fields = getImmediateFields (myState );
83
+ blackhole .consume (fields );
84
+ }
85
+
70
86
private List <SelectedField > getSelectedFields (MyState myState ) {
71
87
DataFetchingFieldSelectionSet dataFetchingFieldSelectionSet = DataFetchingFieldSelectionSetImpl .newCollector (myState .schema , myState .outputFieldType , () -> myState .normalisedField );
72
88
return dataFetchingFieldSelectionSet .getFields ("wontBeFound" );
73
89
}
74
90
91
+ private List <SelectedField > getImmediateFields (MyState myState ) {
92
+ DataFetchingFieldSelectionSet dataFetchingFieldSelectionSet = DataFetchingFieldSelectionSetImpl .newCollector (myState .schema , myState .outputFieldType , () -> myState .normalisedField );
93
+ return dataFetchingFieldSelectionSet .getImmediateFields ();
94
+ }
95
+
75
96
public static void mainX (String [] args ) throws InterruptedException {
76
97
MyState myState = new MyState ();
77
98
myState .setup ();
0 commit comments