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

Dawid Wysakowicz commented on FLINK-14608:
------------------------------------------

I am not sure about that. I fully agree that wrongly written streams will be 
slower. But there are also cases when its actually the opposite (e.g. example 
how important it is to write a properly optimized streams: 
https://blog.overops.com/benchmark-how-java-8-lambdas-and-streams-can-make-your-code-5-times-slower/).
 The differences should especially visible when there are some lazy  
operations. 

I believe this is a case when for-loops will perform better (I actually checked 
that myself with a JMH benchmark and it is most probably true (at least for 
strings as JsonNodes). I think it is good to be cautious though and make such 
decisions with awareness rather than removing all streams. I'm not saying it 
was not the case here. I was rather curious about the results.

> avoid using Java Streams in JsonRowDeserializationSchema
> --------------------------------------------------------
>
>                 Key: FLINK-14608
>                 URL: https://issues.apache.org/jira/browse/FLINK-14608
>             Project: Flink
>          Issue Type: Improvement
>          Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
>    Affects Versions: 1.10.0
>            Reporter: Kurt Young
>            Assignee: Jiayi Liao
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.10.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> According to 
> [https://flink.apache.org/contributing/code-style-and-quality-java.html], we 
> should avoid using Java Streams in any performance critical code. Since this 
> `DeserializationRuntimeConverter` will be called per field of each coming 
> record, we should provide a non Java Streams implementation. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to