From 59cdb5869e7cb6698c09b3f9dea89c7629d48ff2 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Wed, 11 May 2022 15:59:21 -0400 Subject: [PATCH] [BEAM-14347] Add some benchmarks for generic registration (#17613) --- sdks/go/pkg/beam/register/register.go | 240 ++++++++++----------- sdks/go/pkg/beam/register/register.tmpl | 4 +- sdks/go/pkg/beam/register/register_test.go | 149 +++++++++++++ 3 files changed, 271 insertions(+), 122 deletions(-) diff --git a/sdks/go/pkg/beam/register/register.go b/sdks/go/pkg/beam/register/register.go index caeb687bcea0..f8f6895f3612 100644 --- a/sdks/go/pkg/beam/register/register.go +++ b/sdks/go/pkg/beam/register/register.go @@ -2277,8 +2277,8 @@ func (c *caller1x0[I0]) Call(args []interface{}) []interface{} { return []interface{}{} } -func (c *caller1x0[I0]) Call1x0(arg0 I0) { - c.fn(arg0) +func (c *caller1x0[I0]) Call1x0(arg0 interface{}) { + c.fn(arg0.(I0)) } func registerDoFn1x0StructWrappersAndFuncs[I0 any](doFn genericDoFn1x0[I0]) { @@ -2348,8 +2348,8 @@ func (c *caller2x0[I0, I1]) Call(args []interface{}) []interface{} { return []interface{}{} } -func (c *caller2x0[I0, I1]) Call2x0(arg0 I0, arg1 I1) { - c.fn(arg0, arg1) +func (c *caller2x0[I0, I1]) Call2x0(arg0 interface{}, arg1 interface{}) { + c.fn(arg0.(I0), arg1.(I1)) } func registerDoFn2x0StructWrappersAndFuncs[I0, I1 any](doFn genericDoFn2x0[I0, I1]) { @@ -2419,8 +2419,8 @@ func (c *caller3x0[I0, I1, I2]) Call(args []interface{}) []interface{} { return []interface{}{} } -func (c *caller3x0[I0, I1, I2]) Call3x0(arg0 I0, arg1 I1, arg2 I2) { - c.fn(arg0, arg1, arg2) +func (c *caller3x0[I0, I1, I2]) Call3x0(arg0 interface{}, arg1 interface{}, arg2 interface{}) { + c.fn(arg0.(I0), arg1.(I1), arg2.(I2)) } func registerDoFn3x0StructWrappersAndFuncs[I0, I1, I2 any](doFn genericDoFn3x0[I0, I1, I2]) { @@ -2490,8 +2490,8 @@ func (c *caller4x0[I0, I1, I2, I3]) Call(args []interface{}) []interface{} { return []interface{}{} } -func (c *caller4x0[I0, I1, I2, I3]) Call4x0(arg0 I0, arg1 I1, arg2 I2, arg3 I3) { - c.fn(arg0, arg1, arg2, arg3) +func (c *caller4x0[I0, I1, I2, I3]) Call4x0(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}) { + c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3)) } func registerDoFn4x0StructWrappersAndFuncs[I0, I1, I2, I3 any](doFn genericDoFn4x0[I0, I1, I2, I3]) { @@ -2561,8 +2561,8 @@ func (c *caller5x0[I0, I1, I2, I3, I4]) Call(args []interface{}) []interface{} { return []interface{}{} } -func (c *caller5x0[I0, I1, I2, I3, I4]) Call5x0(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4) { - c.fn(arg0, arg1, arg2, arg3, arg4) +func (c *caller5x0[I0, I1, I2, I3, I4]) Call5x0(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}) { + c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4)) } func registerDoFn5x0StructWrappersAndFuncs[I0, I1, I2, I3, I4 any](doFn genericDoFn5x0[I0, I1, I2, I3, I4]) { @@ -2632,8 +2632,8 @@ func (c *caller6x0[I0, I1, I2, I3, I4, I5]) Call(args []interface{}) []interface return []interface{}{} } -func (c *caller6x0[I0, I1, I2, I3, I4, I5]) Call6x0(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5) { - c.fn(arg0, arg1, arg2, arg3, arg4, arg5) +func (c *caller6x0[I0, I1, I2, I3, I4, I5]) Call6x0(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}) { + c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5)) } func registerDoFn6x0StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5 any](doFn genericDoFn6x0[I0, I1, I2, I3, I4, I5]) { @@ -2703,8 +2703,8 @@ func (c *caller7x0[I0, I1, I2, I3, I4, I5, I6]) Call(args []interface{}) []inter return []interface{}{} } -func (c *caller7x0[I0, I1, I2, I3, I4, I5, I6]) Call7x0(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6) { - c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6) +func (c *caller7x0[I0, I1, I2, I3, I4, I5, I6]) Call7x0(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}) { + c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6)) } func registerDoFn7x0StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6 any](doFn genericDoFn7x0[I0, I1, I2, I3, I4, I5, I6]) { @@ -2774,8 +2774,8 @@ func (c *caller8x0[I0, I1, I2, I3, I4, I5, I6, I7]) Call(args []interface{}) []i return []interface{}{} } -func (c *caller8x0[I0, I1, I2, I3, I4, I5, I6, I7]) Call8x0(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7) { - c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +func (c *caller8x0[I0, I1, I2, I3, I4, I5, I6, I7]) Call8x0(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}) { + c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7)) } func registerDoFn8x0StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7 any](doFn genericDoFn8x0[I0, I1, I2, I3, I4, I5, I6, I7]) { @@ -2845,8 +2845,8 @@ func (c *caller9x0[I0, I1, I2, I3, I4, I5, I6, I7, I8]) Call(args []interface{}) return []interface{}{} } -func (c *caller9x0[I0, I1, I2, I3, I4, I5, I6, I7, I8]) Call9x0(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8) { - c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +func (c *caller9x0[I0, I1, I2, I3, I4, I5, I6, I7, I8]) Call9x0(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}) { + c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8)) } func registerDoFn9x0StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8 any](doFn genericDoFn9x0[I0, I1, I2, I3, I4, I5, I6, I7, I8]) { @@ -2916,8 +2916,8 @@ func (c *caller10x0[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9]) Call(args []interfa return []interface{}{} } -func (c *caller10x0[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9]) Call10x0(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8, arg9 I9) { - c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) +func (c *caller10x0[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9]) Call10x0(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}, arg9 interface{}) { + c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8), arg9.(I9)) } func registerDoFn10x0StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9 any](doFn genericDoFn10x0[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9]) { @@ -3058,8 +3058,8 @@ func (c *caller1x1[I0, R0]) Call(args []interface{}) []interface{} { return []interface{}{out0} } -func (c *caller1x1[I0, R0]) Call1x1(arg0 I0) interface{} { - return c.fn(arg0) +func (c *caller1x1[I0, R0]) Call1x1(arg0 interface{}) interface{} { + return c.fn(arg0.(I0)) } func registerDoFn1x1StructWrappersAndFuncs[I0, R0 any](doFn genericDoFn1x1[I0, R0]) { @@ -3129,8 +3129,8 @@ func (c *caller2x1[I0, I1, R0]) Call(args []interface{}) []interface{} { return []interface{}{out0} } -func (c *caller2x1[I0, I1, R0]) Call2x1(arg0 I0, arg1 I1) interface{} { - return c.fn(arg0, arg1) +func (c *caller2x1[I0, I1, R0]) Call2x1(arg0 interface{}, arg1 interface{}) interface{} { + return c.fn(arg0.(I0), arg1.(I1)) } func registerDoFn2x1StructWrappersAndFuncs[I0, I1, R0 any](doFn genericDoFn2x1[I0, I1, R0]) { @@ -3200,8 +3200,8 @@ func (c *caller3x1[I0, I1, I2, R0]) Call(args []interface{}) []interface{} { return []interface{}{out0} } -func (c *caller3x1[I0, I1, I2, R0]) Call3x1(arg0 I0, arg1 I1, arg2 I2) interface{} { - return c.fn(arg0, arg1, arg2) +func (c *caller3x1[I0, I1, I2, R0]) Call3x1(arg0 interface{}, arg1 interface{}, arg2 interface{}) interface{} { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2)) } func registerDoFn3x1StructWrappersAndFuncs[I0, I1, I2, R0 any](doFn genericDoFn3x1[I0, I1, I2, R0]) { @@ -3271,8 +3271,8 @@ func (c *caller4x1[I0, I1, I2, I3, R0]) Call(args []interface{}) []interface{} { return []interface{}{out0} } -func (c *caller4x1[I0, I1, I2, I3, R0]) Call4x1(arg0 I0, arg1 I1, arg2 I2, arg3 I3) interface{} { - return c.fn(arg0, arg1, arg2, arg3) +func (c *caller4x1[I0, I1, I2, I3, R0]) Call4x1(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}) interface{} { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3)) } func registerDoFn4x1StructWrappersAndFuncs[I0, I1, I2, I3, R0 any](doFn genericDoFn4x1[I0, I1, I2, I3, R0]) { @@ -3342,8 +3342,8 @@ func (c *caller5x1[I0, I1, I2, I3, I4, R0]) Call(args []interface{}) []interface return []interface{}{out0} } -func (c *caller5x1[I0, I1, I2, I3, I4, R0]) Call5x1(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4) interface{} { - return c.fn(arg0, arg1, arg2, arg3, arg4) +func (c *caller5x1[I0, I1, I2, I3, I4, R0]) Call5x1(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}) interface{} { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4)) } func registerDoFn5x1StructWrappersAndFuncs[I0, I1, I2, I3, I4, R0 any](doFn genericDoFn5x1[I0, I1, I2, I3, I4, R0]) { @@ -3413,8 +3413,8 @@ func (c *caller6x1[I0, I1, I2, I3, I4, I5, R0]) Call(args []interface{}) []inter return []interface{}{out0} } -func (c *caller6x1[I0, I1, I2, I3, I4, I5, R0]) Call6x1(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5) interface{} { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5) +func (c *caller6x1[I0, I1, I2, I3, I4, I5, R0]) Call6x1(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}) interface{} { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5)) } func registerDoFn6x1StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, R0 any](doFn genericDoFn6x1[I0, I1, I2, I3, I4, I5, R0]) { @@ -3484,8 +3484,8 @@ func (c *caller7x1[I0, I1, I2, I3, I4, I5, I6, R0]) Call(args []interface{}) []i return []interface{}{out0} } -func (c *caller7x1[I0, I1, I2, I3, I4, I5, I6, R0]) Call7x1(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6) interface{} { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6) +func (c *caller7x1[I0, I1, I2, I3, I4, I5, I6, R0]) Call7x1(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}) interface{} { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6)) } func registerDoFn7x1StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, R0 any](doFn genericDoFn7x1[I0, I1, I2, I3, I4, I5, I6, R0]) { @@ -3555,8 +3555,8 @@ func (c *caller8x1[I0, I1, I2, I3, I4, I5, I6, I7, R0]) Call(args []interface{}) return []interface{}{out0} } -func (c *caller8x1[I0, I1, I2, I3, I4, I5, I6, I7, R0]) Call8x1(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7) interface{} { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +func (c *caller8x1[I0, I1, I2, I3, I4, I5, I6, I7, R0]) Call8x1(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}) interface{} { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7)) } func registerDoFn8x1StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, R0 any](doFn genericDoFn8x1[I0, I1, I2, I3, I4, I5, I6, I7, R0]) { @@ -3626,8 +3626,8 @@ func (c *caller9x1[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0]) Call(args []interfac return []interface{}{out0} } -func (c *caller9x1[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0]) Call9x1(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8) interface{} { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +func (c *caller9x1[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0]) Call9x1(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}) interface{} { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8)) } func registerDoFn9x1StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0 any](doFn genericDoFn9x1[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0]) { @@ -3697,8 +3697,8 @@ func (c *caller10x1[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0]) Call(args []int return []interface{}{out0} } -func (c *caller10x1[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0]) Call10x1(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8, arg9 I9) interface{} { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) +func (c *caller10x1[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0]) Call10x1(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}, arg9 interface{}) interface{} { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8), arg9.(I9)) } func registerDoFn10x1StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0 any](doFn genericDoFn10x1[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0]) { @@ -3839,8 +3839,8 @@ func (c *caller1x2[I0, R0, R1]) Call(args []interface{}) []interface{} { return []interface{}{out0, out1} } -func (c *caller1x2[I0, R0, R1]) Call1x2(arg0 I0) (interface{}, interface{}) { - return c.fn(arg0) +func (c *caller1x2[I0, R0, R1]) Call1x2(arg0 interface{}) (interface{}, interface{}) { + return c.fn(arg0.(I0)) } func registerDoFn1x2StructWrappersAndFuncs[I0, R0, R1 any](doFn genericDoFn1x2[I0, R0, R1]) { @@ -3910,8 +3910,8 @@ func (c *caller2x2[I0, I1, R0, R1]) Call(args []interface{}) []interface{} { return []interface{}{out0, out1} } -func (c *caller2x2[I0, I1, R0, R1]) Call2x2(arg0 I0, arg1 I1) (interface{}, interface{}) { - return c.fn(arg0, arg1) +func (c *caller2x2[I0, I1, R0, R1]) Call2x2(arg0 interface{}, arg1 interface{}) (interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1)) } func registerDoFn2x2StructWrappersAndFuncs[I0, I1, R0, R1 any](doFn genericDoFn2x2[I0, I1, R0, R1]) { @@ -3981,8 +3981,8 @@ func (c *caller3x2[I0, I1, I2, R0, R1]) Call(args []interface{}) []interface{} { return []interface{}{out0, out1} } -func (c *caller3x2[I0, I1, I2, R0, R1]) Call3x2(arg0 I0, arg1 I1, arg2 I2) (interface{}, interface{}) { - return c.fn(arg0, arg1, arg2) +func (c *caller3x2[I0, I1, I2, R0, R1]) Call3x2(arg0 interface{}, arg1 interface{}, arg2 interface{}) (interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2)) } func registerDoFn3x2StructWrappersAndFuncs[I0, I1, I2, R0, R1 any](doFn genericDoFn3x2[I0, I1, I2, R0, R1]) { @@ -4052,8 +4052,8 @@ func (c *caller4x2[I0, I1, I2, I3, R0, R1]) Call(args []interface{}) []interface return []interface{}{out0, out1} } -func (c *caller4x2[I0, I1, I2, I3, R0, R1]) Call4x2(arg0 I0, arg1 I1, arg2 I2, arg3 I3) (interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3) +func (c *caller4x2[I0, I1, I2, I3, R0, R1]) Call4x2(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}) (interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3)) } func registerDoFn4x2StructWrappersAndFuncs[I0, I1, I2, I3, R0, R1 any](doFn genericDoFn4x2[I0, I1, I2, I3, R0, R1]) { @@ -4123,8 +4123,8 @@ func (c *caller5x2[I0, I1, I2, I3, I4, R0, R1]) Call(args []interface{}) []inter return []interface{}{out0, out1} } -func (c *caller5x2[I0, I1, I2, I3, I4, R0, R1]) Call5x2(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4) (interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4) +func (c *caller5x2[I0, I1, I2, I3, I4, R0, R1]) Call5x2(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}) (interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4)) } func registerDoFn5x2StructWrappersAndFuncs[I0, I1, I2, I3, I4, R0, R1 any](doFn genericDoFn5x2[I0, I1, I2, I3, I4, R0, R1]) { @@ -4194,8 +4194,8 @@ func (c *caller6x2[I0, I1, I2, I3, I4, I5, R0, R1]) Call(args []interface{}) []i return []interface{}{out0, out1} } -func (c *caller6x2[I0, I1, I2, I3, I4, I5, R0, R1]) Call6x2(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5) (interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5) +func (c *caller6x2[I0, I1, I2, I3, I4, I5, R0, R1]) Call6x2(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}) (interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5)) } func registerDoFn6x2StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, R0, R1 any](doFn genericDoFn6x2[I0, I1, I2, I3, I4, I5, R0, R1]) { @@ -4265,8 +4265,8 @@ func (c *caller7x2[I0, I1, I2, I3, I4, I5, I6, R0, R1]) Call(args []interface{}) return []interface{}{out0, out1} } -func (c *caller7x2[I0, I1, I2, I3, I4, I5, I6, R0, R1]) Call7x2(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6) (interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6) +func (c *caller7x2[I0, I1, I2, I3, I4, I5, I6, R0, R1]) Call7x2(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}) (interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6)) } func registerDoFn7x2StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, R0, R1 any](doFn genericDoFn7x2[I0, I1, I2, I3, I4, I5, I6, R0, R1]) { @@ -4336,8 +4336,8 @@ func (c *caller8x2[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1]) Call(args []interfac return []interface{}{out0, out1} } -func (c *caller8x2[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1]) Call8x2(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7) (interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +func (c *caller8x2[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1]) Call8x2(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}) (interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7)) } func registerDoFn8x2StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1 any](doFn genericDoFn8x2[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1]) { @@ -4407,8 +4407,8 @@ func (c *caller9x2[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1]) Call(args []inte return []interface{}{out0, out1} } -func (c *caller9x2[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1]) Call9x2(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8) (interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +func (c *caller9x2[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1]) Call9x2(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}) (interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8)) } func registerDoFn9x2StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1 any](doFn genericDoFn9x2[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1]) { @@ -4478,8 +4478,8 @@ func (c *caller10x2[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1]) Call(args [ return []interface{}{out0, out1} } -func (c *caller10x2[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1]) Call10x2(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8, arg9 I9) (interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) +func (c *caller10x2[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1]) Call10x2(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}, arg9 interface{}) (interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8), arg9.(I9)) } func registerDoFn10x2StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1 any](doFn genericDoFn10x2[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1]) { @@ -4620,8 +4620,8 @@ func (c *caller1x3[I0, R0, R1, R2]) Call(args []interface{}) []interface{} { return []interface{}{out0, out1, out2} } -func (c *caller1x3[I0, R0, R1, R2]) Call1x3(arg0 I0) (interface{}, interface{}, interface{}) { - return c.fn(arg0) +func (c *caller1x3[I0, R0, R1, R2]) Call1x3(arg0 interface{}) (interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0)) } func registerDoFn1x3StructWrappersAndFuncs[I0, R0, R1, R2 any](doFn genericDoFn1x3[I0, R0, R1, R2]) { @@ -4691,8 +4691,8 @@ func (c *caller2x3[I0, I1, R0, R1, R2]) Call(args []interface{}) []interface{} { return []interface{}{out0, out1, out2} } -func (c *caller2x3[I0, I1, R0, R1, R2]) Call2x3(arg0 I0, arg1 I1) (interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1) +func (c *caller2x3[I0, I1, R0, R1, R2]) Call2x3(arg0 interface{}, arg1 interface{}) (interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1)) } func registerDoFn2x3StructWrappersAndFuncs[I0, I1, R0, R1, R2 any](doFn genericDoFn2x3[I0, I1, R0, R1, R2]) { @@ -4762,8 +4762,8 @@ func (c *caller3x3[I0, I1, I2, R0, R1, R2]) Call(args []interface{}) []interface return []interface{}{out0, out1, out2} } -func (c *caller3x3[I0, I1, I2, R0, R1, R2]) Call3x3(arg0 I0, arg1 I1, arg2 I2) (interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2) +func (c *caller3x3[I0, I1, I2, R0, R1, R2]) Call3x3(arg0 interface{}, arg1 interface{}, arg2 interface{}) (interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2)) } func registerDoFn3x3StructWrappersAndFuncs[I0, I1, I2, R0, R1, R2 any](doFn genericDoFn3x3[I0, I1, I2, R0, R1, R2]) { @@ -4833,8 +4833,8 @@ func (c *caller4x3[I0, I1, I2, I3, R0, R1, R2]) Call(args []interface{}) []inter return []interface{}{out0, out1, out2} } -func (c *caller4x3[I0, I1, I2, I3, R0, R1, R2]) Call4x3(arg0 I0, arg1 I1, arg2 I2, arg3 I3) (interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3) +func (c *caller4x3[I0, I1, I2, I3, R0, R1, R2]) Call4x3(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}) (interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3)) } func registerDoFn4x3StructWrappersAndFuncs[I0, I1, I2, I3, R0, R1, R2 any](doFn genericDoFn4x3[I0, I1, I2, I3, R0, R1, R2]) { @@ -4904,8 +4904,8 @@ func (c *caller5x3[I0, I1, I2, I3, I4, R0, R1, R2]) Call(args []interface{}) []i return []interface{}{out0, out1, out2} } -func (c *caller5x3[I0, I1, I2, I3, I4, R0, R1, R2]) Call5x3(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4) (interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4) +func (c *caller5x3[I0, I1, I2, I3, I4, R0, R1, R2]) Call5x3(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}) (interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4)) } func registerDoFn5x3StructWrappersAndFuncs[I0, I1, I2, I3, I4, R0, R1, R2 any](doFn genericDoFn5x3[I0, I1, I2, I3, I4, R0, R1, R2]) { @@ -4975,8 +4975,8 @@ func (c *caller6x3[I0, I1, I2, I3, I4, I5, R0, R1, R2]) Call(args []interface{}) return []interface{}{out0, out1, out2} } -func (c *caller6x3[I0, I1, I2, I3, I4, I5, R0, R1, R2]) Call6x3(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5) (interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5) +func (c *caller6x3[I0, I1, I2, I3, I4, I5, R0, R1, R2]) Call6x3(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}) (interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5)) } func registerDoFn6x3StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, R0, R1, R2 any](doFn genericDoFn6x3[I0, I1, I2, I3, I4, I5, R0, R1, R2]) { @@ -5046,8 +5046,8 @@ func (c *caller7x3[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2]) Call(args []interfac return []interface{}{out0, out1, out2} } -func (c *caller7x3[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2]) Call7x3(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6) (interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6) +func (c *caller7x3[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2]) Call7x3(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}) (interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6)) } func registerDoFn7x3StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2 any](doFn genericDoFn7x3[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2]) { @@ -5117,8 +5117,8 @@ func (c *caller8x3[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2]) Call(args []inte return []interface{}{out0, out1, out2} } -func (c *caller8x3[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2]) Call8x3(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7) (interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +func (c *caller8x3[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2]) Call8x3(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}) (interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7)) } func registerDoFn8x3StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2 any](doFn genericDoFn8x3[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2]) { @@ -5188,8 +5188,8 @@ func (c *caller9x3[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2]) Call(args [] return []interface{}{out0, out1, out2} } -func (c *caller9x3[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2]) Call9x3(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8) (interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +func (c *caller9x3[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2]) Call9x3(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}) (interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8)) } func registerDoFn9x3StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2 any](doFn genericDoFn9x3[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2]) { @@ -5259,8 +5259,8 @@ func (c *caller10x3[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2]) Call(ar return []interface{}{out0, out1, out2} } -func (c *caller10x3[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2]) Call10x3(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8, arg9 I9) (interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) +func (c *caller10x3[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2]) Call10x3(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}, arg9 interface{}) (interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8), arg9.(I9)) } func registerDoFn10x3StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2 any](doFn genericDoFn10x3[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2]) { @@ -5401,8 +5401,8 @@ func (c *caller1x4[I0, R0, R1, R2, R3]) Call(args []interface{}) []interface{} { return []interface{}{out0, out1, out2, out3} } -func (c *caller1x4[I0, R0, R1, R2, R3]) Call1x4(arg0 I0) (interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0) +func (c *caller1x4[I0, R0, R1, R2, R3]) Call1x4(arg0 interface{}) (interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0)) } func registerDoFn1x4StructWrappersAndFuncs[I0, R0, R1, R2, R3 any](doFn genericDoFn1x4[I0, R0, R1, R2, R3]) { @@ -5472,8 +5472,8 @@ func (c *caller2x4[I0, I1, R0, R1, R2, R3]) Call(args []interface{}) []interface return []interface{}{out0, out1, out2, out3} } -func (c *caller2x4[I0, I1, R0, R1, R2, R3]) Call2x4(arg0 I0, arg1 I1) (interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1) +func (c *caller2x4[I0, I1, R0, R1, R2, R3]) Call2x4(arg0 interface{}, arg1 interface{}) (interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1)) } func registerDoFn2x4StructWrappersAndFuncs[I0, I1, R0, R1, R2, R3 any](doFn genericDoFn2x4[I0, I1, R0, R1, R2, R3]) { @@ -5543,8 +5543,8 @@ func (c *caller3x4[I0, I1, I2, R0, R1, R2, R3]) Call(args []interface{}) []inter return []interface{}{out0, out1, out2, out3} } -func (c *caller3x4[I0, I1, I2, R0, R1, R2, R3]) Call3x4(arg0 I0, arg1 I1, arg2 I2) (interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2) +func (c *caller3x4[I0, I1, I2, R0, R1, R2, R3]) Call3x4(arg0 interface{}, arg1 interface{}, arg2 interface{}) (interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2)) } func registerDoFn3x4StructWrappersAndFuncs[I0, I1, I2, R0, R1, R2, R3 any](doFn genericDoFn3x4[I0, I1, I2, R0, R1, R2, R3]) { @@ -5614,8 +5614,8 @@ func (c *caller4x4[I0, I1, I2, I3, R0, R1, R2, R3]) Call(args []interface{}) []i return []interface{}{out0, out1, out2, out3} } -func (c *caller4x4[I0, I1, I2, I3, R0, R1, R2, R3]) Call4x4(arg0 I0, arg1 I1, arg2 I2, arg3 I3) (interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3) +func (c *caller4x4[I0, I1, I2, I3, R0, R1, R2, R3]) Call4x4(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}) (interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3)) } func registerDoFn4x4StructWrappersAndFuncs[I0, I1, I2, I3, R0, R1, R2, R3 any](doFn genericDoFn4x4[I0, I1, I2, I3, R0, R1, R2, R3]) { @@ -5685,8 +5685,8 @@ func (c *caller5x4[I0, I1, I2, I3, I4, R0, R1, R2, R3]) Call(args []interface{}) return []interface{}{out0, out1, out2, out3} } -func (c *caller5x4[I0, I1, I2, I3, I4, R0, R1, R2, R3]) Call5x4(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4) (interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4) +func (c *caller5x4[I0, I1, I2, I3, I4, R0, R1, R2, R3]) Call5x4(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}) (interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4)) } func registerDoFn5x4StructWrappersAndFuncs[I0, I1, I2, I3, I4, R0, R1, R2, R3 any](doFn genericDoFn5x4[I0, I1, I2, I3, I4, R0, R1, R2, R3]) { @@ -5756,8 +5756,8 @@ func (c *caller6x4[I0, I1, I2, I3, I4, I5, R0, R1, R2, R3]) Call(args []interfac return []interface{}{out0, out1, out2, out3} } -func (c *caller6x4[I0, I1, I2, I3, I4, I5, R0, R1, R2, R3]) Call6x4(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5) (interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5) +func (c *caller6x4[I0, I1, I2, I3, I4, I5, R0, R1, R2, R3]) Call6x4(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}) (interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5)) } func registerDoFn6x4StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, R0, R1, R2, R3 any](doFn genericDoFn6x4[I0, I1, I2, I3, I4, I5, R0, R1, R2, R3]) { @@ -5827,8 +5827,8 @@ func (c *caller7x4[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2, R3]) Call(args []inte return []interface{}{out0, out1, out2, out3} } -func (c *caller7x4[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2, R3]) Call7x4(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6) (interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6) +func (c *caller7x4[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2, R3]) Call7x4(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}) (interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6)) } func registerDoFn7x4StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2, R3 any](doFn genericDoFn7x4[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2, R3]) { @@ -5898,8 +5898,8 @@ func (c *caller8x4[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2, R3]) Call(args [] return []interface{}{out0, out1, out2, out3} } -func (c *caller8x4[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2, R3]) Call8x4(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7) (interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +func (c *caller8x4[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2, R3]) Call8x4(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}) (interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7)) } func registerDoFn8x4StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2, R3 any](doFn genericDoFn8x4[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2, R3]) { @@ -5969,8 +5969,8 @@ func (c *caller9x4[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2, R3]) Call(arg return []interface{}{out0, out1, out2, out3} } -func (c *caller9x4[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2, R3]) Call9x4(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8) (interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +func (c *caller9x4[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2, R3]) Call9x4(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}) (interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8)) } func registerDoFn9x4StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2, R3 any](doFn genericDoFn9x4[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2, R3]) { @@ -6040,8 +6040,8 @@ func (c *caller10x4[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2, R3]) Cal return []interface{}{out0, out1, out2, out3} } -func (c *caller10x4[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2, R3]) Call10x4(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8, arg9 I9) (interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) +func (c *caller10x4[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2, R3]) Call10x4(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}, arg9 interface{}) (interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8), arg9.(I9)) } func registerDoFn10x4StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2, R3 any](doFn genericDoFn10x4[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2, R3]) { @@ -6182,8 +6182,8 @@ func (c *caller1x5[I0, R0, R1, R2, R3, R4]) Call(args []interface{}) []interface return []interface{}{out0, out1, out2, out3, out4} } -func (c *caller1x5[I0, R0, R1, R2, R3, R4]) Call1x5(arg0 I0) (interface{}, interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0) +func (c *caller1x5[I0, R0, R1, R2, R3, R4]) Call1x5(arg0 interface{}) (interface{}, interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0)) } func registerDoFn1x5StructWrappersAndFuncs[I0, R0, R1, R2, R3, R4 any](doFn genericDoFn1x5[I0, R0, R1, R2, R3, R4]) { @@ -6253,8 +6253,8 @@ func (c *caller2x5[I0, I1, R0, R1, R2, R3, R4]) Call(args []interface{}) []inter return []interface{}{out0, out1, out2, out3, out4} } -func (c *caller2x5[I0, I1, R0, R1, R2, R3, R4]) Call2x5(arg0 I0, arg1 I1) (interface{}, interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1) +func (c *caller2x5[I0, I1, R0, R1, R2, R3, R4]) Call2x5(arg0 interface{}, arg1 interface{}) (interface{}, interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1)) } func registerDoFn2x5StructWrappersAndFuncs[I0, I1, R0, R1, R2, R3, R4 any](doFn genericDoFn2x5[I0, I1, R0, R1, R2, R3, R4]) { @@ -6324,8 +6324,8 @@ func (c *caller3x5[I0, I1, I2, R0, R1, R2, R3, R4]) Call(args []interface{}) []i return []interface{}{out0, out1, out2, out3, out4} } -func (c *caller3x5[I0, I1, I2, R0, R1, R2, R3, R4]) Call3x5(arg0 I0, arg1 I1, arg2 I2) (interface{}, interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2) +func (c *caller3x5[I0, I1, I2, R0, R1, R2, R3, R4]) Call3x5(arg0 interface{}, arg1 interface{}, arg2 interface{}) (interface{}, interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2)) } func registerDoFn3x5StructWrappersAndFuncs[I0, I1, I2, R0, R1, R2, R3, R4 any](doFn genericDoFn3x5[I0, I1, I2, R0, R1, R2, R3, R4]) { @@ -6395,8 +6395,8 @@ func (c *caller4x5[I0, I1, I2, I3, R0, R1, R2, R3, R4]) Call(args []interface{}) return []interface{}{out0, out1, out2, out3, out4} } -func (c *caller4x5[I0, I1, I2, I3, R0, R1, R2, R3, R4]) Call4x5(arg0 I0, arg1 I1, arg2 I2, arg3 I3) (interface{}, interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3) +func (c *caller4x5[I0, I1, I2, I3, R0, R1, R2, R3, R4]) Call4x5(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}) (interface{}, interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3)) } func registerDoFn4x5StructWrappersAndFuncs[I0, I1, I2, I3, R0, R1, R2, R3, R4 any](doFn genericDoFn4x5[I0, I1, I2, I3, R0, R1, R2, R3, R4]) { @@ -6466,8 +6466,8 @@ func (c *caller5x5[I0, I1, I2, I3, I4, R0, R1, R2, R3, R4]) Call(args []interfac return []interface{}{out0, out1, out2, out3, out4} } -func (c *caller5x5[I0, I1, I2, I3, I4, R0, R1, R2, R3, R4]) Call5x5(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4) (interface{}, interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4) +func (c *caller5x5[I0, I1, I2, I3, I4, R0, R1, R2, R3, R4]) Call5x5(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}) (interface{}, interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4)) } func registerDoFn5x5StructWrappersAndFuncs[I0, I1, I2, I3, I4, R0, R1, R2, R3, R4 any](doFn genericDoFn5x5[I0, I1, I2, I3, I4, R0, R1, R2, R3, R4]) { @@ -6537,8 +6537,8 @@ func (c *caller6x5[I0, I1, I2, I3, I4, I5, R0, R1, R2, R3, R4]) Call(args []inte return []interface{}{out0, out1, out2, out3, out4} } -func (c *caller6x5[I0, I1, I2, I3, I4, I5, R0, R1, R2, R3, R4]) Call6x5(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5) (interface{}, interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5) +func (c *caller6x5[I0, I1, I2, I3, I4, I5, R0, R1, R2, R3, R4]) Call6x5(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}) (interface{}, interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5)) } func registerDoFn6x5StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, R0, R1, R2, R3, R4 any](doFn genericDoFn6x5[I0, I1, I2, I3, I4, I5, R0, R1, R2, R3, R4]) { @@ -6608,8 +6608,8 @@ func (c *caller7x5[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2, R3, R4]) Call(args [] return []interface{}{out0, out1, out2, out3, out4} } -func (c *caller7x5[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2, R3, R4]) Call7x5(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6) (interface{}, interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6) +func (c *caller7x5[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2, R3, R4]) Call7x5(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}) (interface{}, interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6)) } func registerDoFn7x5StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2, R3, R4 any](doFn genericDoFn7x5[I0, I1, I2, I3, I4, I5, I6, R0, R1, R2, R3, R4]) { @@ -6679,8 +6679,8 @@ func (c *caller8x5[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2, R3, R4]) Call(arg return []interface{}{out0, out1, out2, out3, out4} } -func (c *caller8x5[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2, R3, R4]) Call8x5(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7) (interface{}, interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +func (c *caller8x5[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2, R3, R4]) Call8x5(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}) (interface{}, interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7)) } func registerDoFn8x5StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2, R3, R4 any](doFn genericDoFn8x5[I0, I1, I2, I3, I4, I5, I6, I7, R0, R1, R2, R3, R4]) { @@ -6750,8 +6750,8 @@ func (c *caller9x5[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2, R3, R4]) Call return []interface{}{out0, out1, out2, out3, out4} } -func (c *caller9x5[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2, R3, R4]) Call9x5(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8) (interface{}, interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +func (c *caller9x5[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2, R3, R4]) Call9x5(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}) (interface{}, interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8)) } func registerDoFn9x5StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2, R3, R4 any](doFn genericDoFn9x5[I0, I1, I2, I3, I4, I5, I6, I7, I8, R0, R1, R2, R3, R4]) { @@ -6821,8 +6821,8 @@ func (c *caller10x5[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2, R3, R4]) return []interface{}{out0, out1, out2, out3, out4} } -func (c *caller10x5[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2, R3, R4]) Call10x5(arg0 I0, arg1 I1, arg2 I2, arg3 I3, arg4 I4, arg5 I5, arg6 I6, arg7 I7, arg8 I8, arg9 I9) (interface{}, interface{}, interface{}, interface{}, interface{}) { - return c.fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) +func (c *caller10x5[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2, R3, R4]) Call10x5(arg0 interface{}, arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{}, arg5 interface{}, arg6 interface{}, arg7 interface{}, arg8 interface{}, arg9 interface{}) (interface{}, interface{}, interface{}, interface{}, interface{}) { + return c.fn(arg0.(I0), arg1.(I1), arg2.(I2), arg3.(I3), arg4.(I4), arg5.(I5), arg6.(I6), arg7.(I7), arg8.(I8), arg9.(I9)) } func registerDoFn10x5StructWrappersAndFuncs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2, R3, R4 any](doFn genericDoFn10x5[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, R0, R1, R2, R3, R4]) { diff --git a/sdks/go/pkg/beam/register/register.tmpl b/sdks/go/pkg/beam/register/register.tmpl index 459b97e321f7..b615c784a711 100644 --- a/sdks/go/pkg/beam/register/register.tmpl +++ b/sdks/go/pkg/beam/register/register.tmpl @@ -151,8 +151,8 @@ func (c *caller{{$processElementIn}}x{{$processElementOut}}{{(genericTypingRepre return []interface{}{ {{if $processElementOut}}{{range $out := upto $processElementOut}}{{if $out}}, {{end}}out{{$out}}{{end}}{{end}} } } -func (c *caller{{$processElementIn}}x{{$processElementOut}}{{(genericTypingRepresentation $processElementIn $processElementOut false)}}) Call{{$processElementIn}}x{{$processElementOut}}({{range $in := upto $processElementIn}}{{if $in}}, {{end}}arg{{$in}} I{{$in}}{{end}}){{if $processElementOut}} ({{range $out := upto $processElementOut}}{{if $out}}, {{end}}interface{}{{end}}){{end}} { - {{if $processElementOut}}return {{end}}c.fn({{range $in := upto $processElementIn}}{{if $in}}, {{end}}arg{{$in}}{{end}}) +func (c *caller{{$processElementIn}}x{{$processElementOut}}{{(genericTypingRepresentation $processElementIn $processElementOut false)}}) Call{{$processElementIn}}x{{$processElementOut}}({{range $in := upto $processElementIn}}{{if $in}}, {{end}}arg{{$in}} interface{}{{end}}){{if $processElementOut}} ({{range $out := upto $processElementOut}}{{if $out}}, {{end}}interface{}{{end}}){{end}} { + {{if $processElementOut}}return {{end}}c.fn({{range $in := upto $processElementIn}}{{if $in}}, {{end}}arg{{$in}}.(I{{$in}}){{end}}) } func registerDoFn{{$processElementIn}}x{{$processElementOut}}StructWrappersAndFuncs{{(genericTypingRepresentation $processElementIn $processElementOut true)}}(doFn genericDoFn{{$processElementIn}}x{{$processElementOut}}{{(genericTypingRepresentation $processElementIn $processElementOut false)}}) { diff --git a/sdks/go/pkg/beam/register/register_test.go b/sdks/go/pkg/beam/register/register_test.go index e89b2c123100..9aee375b14ac 100644 --- a/sdks/go/pkg/beam/register/register_test.go +++ b/sdks/go/pkg/beam/register/register_test.go @@ -20,9 +20,12 @@ import ( "reflect" "testing" + "github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph" "github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph/mtime" "github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph/window" + "github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime" "github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime/exec" + "github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime/graphx" "github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime/graphx/schema" "github.com/apache/beam/sdks/v2/go/pkg/beam/core/typex" "github.com/apache/beam/sdks/v2/go/pkg/beam/core/util/reflectx" @@ -672,3 +675,149 @@ func (fn *PartialCombiner2) AddInput(i int, c CustomType) int { func (fn *PartialCombiner2) MergeAccumulators(i1 int, i2 int) int { return i1 + i2 } + +// Foo is a struct with a method for measuring method invocation +// overhead for StructuralDoFns. +type Foo struct { + A int +} + +// ProcessElement is a method for measuring a baseline of structural dofn overhead. +func (f *Foo) ProcessElement(b CustomType) int { + return f.A + b.val +} + +func MakeMultiEdge(f *graph.DoFn) graph.MultiEdge { + return graph.MultiEdge{ + DoFn: f, + } +} + +type callerCustomTypeГint struct { + fn func(CustomType) int +} + +func funcMakerCustomTypeГint(fn interface{}) reflectx.Func { + f := fn.(func(CustomType) int) + return &callerCustomTypeГint{fn: f} +} + +func (c *callerCustomTypeГint) Name() string { + return reflectx.FunctionName(c.fn) +} + +func (c *callerCustomTypeГint) Type() reflect.Type { + return reflect.TypeOf(c.fn) +} + +func (c *callerCustomTypeГint) Call(args []interface{}) []interface{} { + out0 := c.fn(args[0].(CustomType)) + return []interface{}{out0} +} + +func (c *callerCustomTypeГint) Call1x1(arg0 interface{}) interface{} { + return c.fn(arg0.(CustomType)) +} + +func wrapMakerFoo(fn interface{}) map[string]reflectx.Func { + dfn := fn.(*Foo) + return map[string]reflectx.Func{ + "ProcessElement": reflectx.MakeFunc(func(a0 CustomType) int { return dfn.ProcessElement(a0) }), + } +} + +func GeneratedOptimizationCalls() { + runtime.RegisterType(reflect.TypeOf((*Foo)(nil)).Elem()) + schema.RegisterType(reflect.TypeOf((*Foo)(nil)).Elem()) + runtime.RegisterType(reflect.TypeOf((*CustomType)(nil)).Elem()) + schema.RegisterType(reflect.TypeOf((*CustomType)(nil)).Elem()) + reflectx.RegisterFunc(reflect.TypeOf((*func(CustomType) int)(nil)).Elem(), funcMakerCustomTypeГint) + reflectx.RegisterStructWrapper(reflect.TypeOf((*Foo)(nil)).Elem(), wrapMakerFoo) +} + +// BenchmarkMethodCalls measures the overhead of invoking several different methods after performing +// different types of registration. The unoptimized calls don't perform any optimization. The +// GenericRegistration calls first register the DoFn being used with this package's generic registration +// functions. This is the preferred path for users. The GeneratedShims calls call various registration +// functions, mirroring the behavior of the shims generated by the code generator. This is not the +// recommended path for most users - if these are materially better than the generic benchmarks, +// this package requires further optimization. +// +// BenchmarkMethodCalls/MakeFunc_Unoptimized-16 11480814 88.35 ns/op +// BenchmarkMethodCalls/MakeFunc.Call_Unoptimized-16 3525211 324.0 ns/op +// BenchmarkMethodCalls/MakeFunc.Call1x1_Unoptimized-16 3450822 343.0 ns/op +// BenchmarkMethodCalls/NewFn_Unoptimized-16 875199 1385 ns/op +// BenchmarkMethodCalls/EncodeMultiEdge_Unoptimized-16 1000000 1063 ns/op +// +// BenchmarkMethodCalls/MakeFunc_GenericRegistration-16 16266259 72.07 ns/op +// BenchmarkMethodCalls/MakeFunc.Call_GenericRegistration-16 38331327 32.70 ns/op +// BenchmarkMethodCalls/MakeFunc.Call1x1_GenericRegistration-16 135934086 8.434 ns/op +// BenchmarkMethodCalls/NewFn_GenericRegistration-16 1000000 1108 ns/op +// BenchmarkMethodCalls/EncodeMultiEdge_GenericRegistration-16 1000000 1052 ns/op +// +// BenchmarkMethodCalls/MakeFunc_GeneratedShims-16 16400914 69.17 ns/op +// BenchmarkMethodCalls/MakeFunc.Call_GeneratedShims-16 37106445 33.69 ns/op +// BenchmarkMethodCalls/MakeFunc.Call1x1_GeneratedShims-16 141127965 8.312 ns/op +// BenchmarkMethodCalls/NewFn_GeneratedShims-16 1000000 1099 ns/op +// BenchmarkMethodCalls/EncodeMultiEdge_GeneratedShims-16 1000000 1071 ns/op +func BenchmarkMethodCalls(b *testing.B) { + f := &Foo{A: 3} + g, err := graph.NewFn(&Foo{A: 5}) + if err != nil { + panic(err) + } + gDoFn, err := graph.AsDoFn(g, 1) + if err != nil { + panic(err) + } + me := MakeMultiEdge(gDoFn) + + var aFunc reflectx.Func + var aFn *graph.Fn + var aME interface{} + var aFnCall int + var aFunc1x1 reflectx.Func1x1 + funcIn := []interface{}{CustomType{val: 4}} + + // We need to do this registration just to get it to not panic when encoding the multi-edge with no additional optimization. + // This is currently required of users anyways + runtime.RegisterType(reflect.TypeOf((*Foo)(nil))) + tests := []struct { + name string + fn func() + registration func() + }{ + // No optimization performed at all + {"MakeFunc_Unoptimized", func() { aFunc = reflectx.MakeFunc(f.ProcessElement) }, func() { /*No op*/ }}, // Used in graph deserialization + {"MakeFunc.Call_Unoptimized", func() { aFnCall = aFunc.Call(funcIn)[0].(int) }, func() { /*No op*/ }}, // Used to call the function repeatedly + {"MakeFunc.Call1x1_Unoptimized", func() { aFnCall = aFunc1x1.Call1x1(CustomType{val: 4}).(int) }, func() { aFunc1x1 = reflectx.ToFunc1x1(aFunc) }}, // Used to call the function repeatedly + {"NewFn_Unoptimized", func() { aFn, _ = graph.NewFn(f) }, func() { /*No op*/ }}, // Used in graph construction (less valuable) + {"EncodeMultiEdge_Unoptimized", func() { aME, _ = graphx.EncodeMultiEdge(&me) }, func() { /*No op*/ }}, // Used in graph serialization at execution time + + // Perform some generic registration to optimize execution + {"MakeFunc_GenericRegistration", func() { aFunc = reflectx.MakeFunc(f.ProcessElement) }, func() { DoFn1x1[CustomType, int](f) }}, // Used in graph deserialization + {"MakeFunc.Call_GenericRegistration", func() { aFnCall = aFunc.Call(funcIn)[0].(int) }, func() { DoFn1x1[CustomType, int](f) }}, // Used to call the function repeatedly + {"MakeFunc.Call1x1_GenericRegistration", func() { aFnCall = aFunc1x1.Call1x1(CustomType{val: 3}).(int) }, func() { DoFn1x1[CustomType, int](f); aFunc1x1 = reflectx.ToFunc1x1(aFunc) }}, // Used to call the function repeatedly + {"NewFn_GenericRegistration", func() { aFn, _ = graph.NewFn(f) }, func() { DoFn1x1[CustomType, int](f) }}, // Used in graph construction (less valuable) + {"EncodeMultiEdge_GenericRegistration", func() { aME, _ = graphx.EncodeMultiEdge(&me) }, func() { DoFn1x1[CustomType, int](f) }}, // Used in graph serialization at execution time + + // Perform some registration via copies of the code generator's shims + {"MakeFunc_GeneratedShims", func() { aFunc = reflectx.MakeFunc(f.ProcessElement) }, func() { GeneratedOptimizationCalls() }}, // Used in graph deserialization + {"MakeFunc.Call_GeneratedShims", func() { aFnCall = aFunc.Call(funcIn)[0].(int) }, func() { GeneratedOptimizationCalls() }}, // Used to call the function repeatedly + {"MakeFunc.Call1x1_GeneratedShims", func() { aFnCall = aFunc1x1.Call1x1(CustomType{val: 5}).(int) }, func() { GeneratedOptimizationCalls(); aFunc1x1 = reflectx.ToFunc1x1(aFunc) }}, // Used to call the function repeatedly + {"NewFn_GeneratedShims", func() { aFn, _ = graph.NewFn(f) }, func() { GeneratedOptimizationCalls() }}, // Used in graph construction (less valuable) + {"EncodeMultiEdge_GeneratedShims", func() { aME, err = graphx.EncodeMultiEdge(&me) }, func() { GeneratedOptimizationCalls() }}, // Used in graph serialization at execution time + } + for _, test := range tests { + test.registration() + b.Run(test.name, func(b *testing.B) { + for i := 0; i < b.N; i++ { + test.fn() + } + }) + } + b.Log(aFunc) + b.Log(aFnCall) + b.Log(aFn) + b.Log(aME) +}