[ https://issues.apache.org/jira/browse/BEAM-37?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345529#comment-15345529 ]
ASF GitHub Bot commented on BEAM-37: ------------------------------------ GitHub user bjchambers opened a pull request: https://github.com/apache/incubator-beam/pull/521 [BEAM-37] DoFnReflector: Add inoker interface and generate code Be sure to do all of the following to help us incorporate your contribution quickly and easily: - [*] Make sure the PR title is formatted like: `[BEAM-<Jira issue #>] Description of pull request` - [*] Make sure tests pass via `mvn clean verify`. (Even better, enable Travis-CI on your fork and ensure the whole test matrix passes). - [*] Replace `<Jira issue #>` in the title with the actual Jira issue number, if there is one. - [*] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.txt). --- The method to call for a DoFnWithContext requires reflection since the shape of the parameters may change. Doing so in each processElement call puts this refelection in the hot path. This PR introduces a DoFnInvoker interface which is bound to a specific DoFnWithContext and delegates the three important methods (startBundle, processElement, finishBundle). It uses byte-buddy to generate a simple trampoline implementation of the DoFnInvoker class for each type of DoFnWithContext. This leads to 2-3x better performance in micro-benchmarks of method dispatching. You can merge this pull request into a Git repository by running: $ git pull https://github.com/bjchambers/incubator-beam byte-buddy-dofn Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-beam/pull/521.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #521 ---- commit 009be346ecbf4e2db899982f6070e2208e47be10 Author: Ben Chambers <bchamb...@google.com> Date: 2016-06-22T13:47:23Z [BEAM-37] DoFnReflector: Add inoker interface and generate code The method to call for a DoFnWithContext requires reflection since the shape of the parameters may change. Doing so in each processElement call puts this refelection in the hot path. This PR introduces a DoFnInvoker interface which is bound to a specific DoFnWithContext and delegates the three important methods (startBundle, processElement, finishBundle). It uses byte-buddy to generate a simple trampoline implementation of the DoFnInvoker class for each type of DoFnWithContext. This leads to 2-3x better performance in micro-benchmarks of method dispatching. ---- > Run DoFnWithContext without conversion to vanilla DoFn > ------------------------------------------------------ > > Key: BEAM-37 > URL: https://issues.apache.org/jira/browse/BEAM-37 > Project: Beam > Issue Type: Sub-task > Components: runner-core > Reporter: Kenneth Knowles > Assignee: Kenneth Knowles > > DoFnWithContext is an enhanced DoFn where annotations and parameter lists are > inspected to determine whether it accesses windowing information, etc. > Today, each feature of DoFnWithContext requires implementation on DoFn, which > precludes the easy addition of features that we don't have designs for in > DoFn. -- This message was sent by Atlassian JIRA (v6.3.4#6332)