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.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---