From 6760505a7e7874654925fbfc3bac8c7f634b7f8e Mon Sep 17 00:00:00 2001 From: Himanshu Date: Thu, 4 Jul 2019 08:41:17 -0700 Subject: [PATCH] fix FileUtils performance regression due to FilterOutputStream (#8024) --- .../java/org/apache/druid/java/util/common/FileUtils.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/src/main/java/org/apache/druid/java/util/common/FileUtils.java b/core/src/main/java/org/apache/druid/java/util/common/FileUtils.java index 17f0ed01c33..6025ad6cf73 100644 --- a/core/src/main/java/org/apache/druid/java/util/common/FileUtils.java +++ b/core/src/main/java/org/apache/druid/java/util/common/FileUtils.java @@ -242,6 +242,14 @@ public class FileUtils { return new FilterOutputStream(out) { + // Default implementation of this method in FilterOutputStream converts single write operation to + // multiple write operations of 1 byte each, which is terribly inefficient. + @Override + public void write(byte b[], int off, int len) throws IOException + { + out.write(b, off, len); + } + @Override public void close() {