You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (Jira)" <ji...@apache.org> on 2025/08/08 06:03:00 UTC
[jira] [Resolved] (SPARK-53190) Use Java `InputStream.transferTo` instead of `ByteStreams.copy`
[ https://issues.apache.org/jira/browse/SPARK-53190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dongjoon Hyun resolved SPARK-53190.
-----------------------------------
Fix Version/s: 4.1.0
Resolution: Fixed
Issue resolved by pull request 51918
[https://github.com/apache/spark/pull/51918]
> Use Java `InputStream.transferTo` instead of `ByteStreams.copy`
> ---------------------------------------------------------------
>
> Key: SPARK-53190
> URL: https://issues.apache.org/jira/browse/SPARK-53190
> Project: Spark
> Issue Type: Sub-task
> Components: Spark Core
> Affects Versions: 4.1.0
> Reporter: Dongjoon Hyun
> Assignee: Dongjoon Hyun
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.1.0
>
>
> Java `transferTo` is significantly faster than `ByteStreams.copy`.
> {code}
> scala> import java.io._
> import java.io._
> scala> spark.time(new FileInputStream("/tmp/4G.bin").transferTo(new FileOutputStream("/dev/null")))
> Time taken: 5 ms
> val res2: Long = 4294967296
> scala> spark.time(com.google.common.io.ByteStreams.copy(new FileInputStream("/tmp/4G.bin"), new FileOutputStream("/dev/null")))
> Time taken: 772 ms
> val res3: Long = 4294967296
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org