@@ -249,3 +249,46 @@ func TestJTDInferWithDiscriminatorHints(t *testing.T) {
249249
250250 assert .EqualValues (t , expectedSchema , gotSchema )
251251}
252+
253+ func BenchmarkInferOneRowNoMissingHints (b * testing.B ) {
254+ wors := generateRows (1 )
255+ emptyHints := NewHints ()
256+
257+ for n := 0 ; n < b .N ; n ++ {
258+ InferStrings (wors , emptyHints )
259+ }
260+ }
261+
262+ func BenchmarkInferThousandRowsNoMissingHints (b * testing.B ) {
263+ rows := generateRows (1000 )
264+ emptyHints := NewHints ()
265+
266+ for n := 0 ; n < b .N ; n ++ {
267+ InferStrings (rows , emptyHints )
268+ }
269+ }
270+
271+ func BenchmarkInferOneRowMissingHints (b * testing.B ) {
272+ rows := generateRows (1 )
273+ for n := 0 ; n < b .N ; n ++ {
274+ InferStrings (rows , nil )
275+ }
276+ }
277+
278+ func BenchmarkInferThousandRowsMissingHints (b * testing.B ) {
279+ rows := generateRows (1000 )
280+ for n := 0 ; n < b .N ; n ++ {
281+ InferStrings (rows , nil )
282+ }
283+ }
284+
285+ func generateRows (n int ) []string {
286+ row := `{"name":"bench", "speed":100.2}`
287+ rows := []string {}
288+
289+ for i := 0 ; i < n ; i ++ {
290+ rows = append (rows , row )
291+ }
292+
293+ return rows
294+ }
0 commit comments