[ 
https://issues.apache.org/jira/browse/FLINK-9435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16539274#comment-16539274
 ] 

ASF GitHub Bot commented on FLINK-9435:
---------------------------------------

Github user NicoK commented on the issue:

    https://github.com/apache/flink/pull/6115
  
    alright - tried that change which also has the advantage of not using up 
memory for the `templateKey` - these are the results from the same Benchmark 
(same hardware, new software though, so I also re-did the old benchmark and ran 
them twice):
    ```
    old:
    
    Benchmark                    Mode  Cnt     Score    Error   Units
    KeyByBenchmarks.arrayKeyBy  thrpt   30  1151.305 ± 21.096  ops/ms
    KeyByBenchmarks.arrayKeyBy  thrpt   30  1117.486 ± 43.508  ops/ms
    KeyByBenchmarks.tupleKeyBy  thrpt   30  1659.634 ± 28.627  ops/ms
    KeyByBenchmarks.tupleKeyBy  thrpt   30  1554.265 ± 82.604  ops/ms
    
    new:
    
    KeyByBenchmarks.arrayKeyBy  thrpt   30  1150.552 ± 51.185  ops/ms
    KeyByBenchmarks.arrayKeyBy  thrpt   30  1195.777 ± 10.621  ops/ms
    KeyByBenchmarks.tupleKeyBy  thrpt   30  1743.633 ± 27.109  ops/ms
    KeyByBenchmarks.tupleKeyBy  thrpt   30  1697.885 ± 22.101  ops/ms
    ```


> Remove per-key selection Tuple instantiation via reflection in 
> ComparableKeySelector and ArrayKeySelector
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-9435
>                 URL: https://issues.apache.org/jira/browse/FLINK-9435
>             Project: Flink
>          Issue Type: Improvement
>          Components: Streaming
>    Affects Versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.4.0, 1.5.0, 1.4.1, 1.4.2, 
> 1.6.0
>            Reporter: Nico Kruber
>            Assignee: Nico Kruber
>            Priority: Major
>              Labels: pull-request-available
>
> Inside {{KeySelectorUtil}}, every {{ComparableKeySelector#getKey()}} call 
> currently creates a new tuple from 
> {{Tuple.getTupleClass(keyLength).newInstance();}} which seems expensive. 
> Instead, we could get a template tuple and use {{Tuple#copy()}} which copies 
> the right sub-class in a more optimal way.
> Similarly, {{ArrayKeySelector}} instantiates new {{Tuple}} instances via 
> reflection which can be changed the same way.



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

Reply via email to