[
https://issues.apache.org/jira/browse/BEAM-14347?focusedWorklogId=765513&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-765513
]
ASF GitHub Bot logged work on BEAM-14347:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 03/May/22 16:00
Start Date: 03/May/22 16:00
Worklog Time Spent: 10m
Work Description: damccorm commented on code in PR #17429:
URL: https://github.com/apache/beam/pull/17429#discussion_r863934043
##########
sdks/go/pkg/beam/registration/registration.tmpl:
##########
@@ -0,0 +1,252 @@
+{{define "BuildWrapper_StartFinishBundle"}}
+{{$lowerName := "unknown"}}{{$upperName := "unknown"}}{{if (eq .func
"startBundle")}}{{$lowerName = "startBundle"}}{{$upperName =
"StartBundle"}}{{end}}{{if (eq .func "finishBundle")}}{{$lowerName =
"finishBundle"}}{{$upperName = "FinishBundle"}}{{end}}{{$startFinishBundleMaxIn
:= .startFinishBundleMaxIn}}{{$processElementMaxIn := .processElementMaxIn}}
+{{range $numParams := upto $processElementMaxIn}}
+func build{{$upperName}}Wrapper{{$numParams}}{{(genericTypingRepresentation
$numParams 0 true)}}(doFn interface{}) func(interface{}) reflectx.Func {
Review Comment:
Yeah, that helps a lot. Technically, this does introduce a little more
comparison overhead (so the registration call will be slower), but not nearly
as much as I originally thought (read: not a significant amount), and the
reduced sdk size is worth it. The extra comparisons were the reason I didn't
initially structure it this way.
Issue Time Tracking
-------------------
Worklog Id: (was: 765513)
Time Spent: 3h 50m (was: 3h 40m)
> [Go SDK] Allow users to optimize DoFns with a single generic registration
> function
> ----------------------------------------------------------------------------------
>
> Key: BEAM-14347
> URL: https://issues.apache.org/jira/browse/BEAM-14347
> Project: Beam
> Issue Type: New Feature
> Components: sdk-go
> Reporter: Danny McCormick
> Assignee: Danny McCormick
> Priority: P2
> Time Spent: 3h 50m
> Remaining Estimate: 0h
>
> Right now, to optimize DoFn execution, users have to use the code generator.
> This updates to allow them to use generics instead.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)