You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/09/06 13:09:37 UTC

[GitHub] pnowojski commented on a change in pull request #6417: [FLINK-9913][runtime] Improve output serialization only once in RecordWriter

pnowojski commented on a change in pull request #6417: [FLINK-9913][runtime] Improve output serialization only once in RecordWriter
URL: https://github.com/apache/flink/pull/6417#discussion_r215611369
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java
 ##########
 @@ -197,40 +214,39 @@ public void setMetricGroup(TaskIOMetricGroup metrics) {
 	 * Marks the current {@link BufferBuilder} as finished and clears the state for next one.
 	 */
 	private void tryFinishCurrentBufferBuilder(int targetChannel) {
-		if (bufferBuilders[targetChannel].isPresent()) {
-			BufferBuilder bufferBuilder = bufferBuilders[targetChannel].get();
+		Optional<BufferBuilder> bufferBuilderOpt = bufferBuilders[targetChannel];
 
 Review comment:
   Rename to `bufferBuilder` (marking type in variable name is not the best practice). 
   
   Have you seen throughput improvements by introducing this local variable? If not, maybe revert the change?
   
   FYI: When I was writing this code, I didn't see any performance improvement (and I was testing this exact change). Removing one extra CPU cache read (second `bufferBuilders[targetChannel]` access will either be optimised out or it will be a read from CPU caches/registries) usually hardly matters compared to taking locks :( 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services