[ 
https://issues.apache.org/jira/browse/BEAM-4726?focusedWorklogId=179175&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-179175
 ]

ASF GitHub Bot logged work on BEAM-4726:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Dec/18 18:34
            Start Date: 27/Dec/18 18:34
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on pull request #7355: [BEAM-4726] 
Add arity specialization for calling and returns.
URL: https://github.com/apache/beam/pull/7355#discussion_r244204426
 
 

 ##########
 File path: sdks/go/pkg/beam/core/runtime/exec/fn.go
 ##########
 @@ -117,10 +127,18 @@ func (n *invoker) Invoke(ctx context.Context, ws 
[]typex.Window, ts typex.EventT
        // (2) Main input from value, if any.
        i := 0
        if opt != nil {
-               args[in[i]] = Convert(opt.Key.Elm, fn.Param[in[i]].T)
+               if n.elmConvert == nil {
+                       from := reflect.TypeOf(opt.Key.Elm)
+                       n.elmConvert = ConvertFn(from, fn.Param[in[i]].T)
+               }
+               args[in[i]] = n.elmConvert(opt.Key.Elm)
 
 Review comment:
   I'd rather that it panic, asserting that all values passed from the previous 
unit be of the same type. Most cases, the user's functions are required to be 
of a given type anyway, making these to be the identity function anyway. That's 
checked at pipeline construction time.
   
   The cases where this isn't true are for []byte to string, since beam cheats 
and uses the same encoding for strings and bytes, which we don't encode 
separately, and for lists of "universal types" which need to be converted 
element by element anyway. (Universal types are the quasi-generics beam has 
implemented, to allow a bit of function re-use.)
   
   If a user is returning arbitrary types as beam.T s then the runtime type 
checker will fail for them.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 179175)
    Time Spent: 8h 50m  (was: 8h 40m)

> Reduce ParDo per element Invoke overhead
> ----------------------------------------
>
>                 Key: BEAM-4726
>                 URL: https://issues.apache.org/jira/browse/BEAM-4726
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-go
>            Reporter: Robert Burke
>            Assignee: Robert Burke
>            Priority: Major
>          Time Spent: 8h 50m
>  Remaining Estimate: 0h
>
> Each call to invoke allocates a new args []interface{}, but the common case 
> is to run the same ProcessElement function over and again. It should be 
> possible to have a container struct to retain the args slice, and avoid 
> recomputing the indices for where to assign parameters before calling the 
> ProcessElementFn.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to