[ https://issues.apache.org/jira/browse/FLINK-2125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14802964#comment-14802964 ]
ASF GitHub Bot commented on FLINK-2125: --------------------------------------- Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/1077#discussion_r39749641 --- Diff: flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunction.java --- @@ -117,12 +122,13 @@ private void streamFromSocket(SourceContext<String> ctx, Socket socket) throws E continue; } - if (data == delimiter) { - ctx.collect(buffer.toString()); - buffer = new StringBuilder(); - } else if (data != '\r') { // ignore carriage return - buffer.append((char) data); + buffer.append(charBuffer, 0, readCount); + String[] splits = buffer.toString().split(delimiter); --- End diff -- `String.split()` and `String.replace()` create new String objects which must be garbage collected. This adds quite some overhead, because these functions are called very often. The previous implementation was operating on a byte-level and avoiding the creation of new objects. It would be good if we could preserve this behavior. > String delimiter for SocketTextStream > ------------------------------------- > > Key: FLINK-2125 > URL: https://issues.apache.org/jira/browse/FLINK-2125 > Project: Flink > Issue Type: Improvement > Components: Streaming > Affects Versions: 0.9 > Reporter: Márton Balassi > Priority: Minor > Labels: starter > > The SocketTextStreamFunction uses a character delimiter, despite other parts > of the API using String delimiter. -- This message was sent by Atlassian JIRA (v6.3.4#6332)