For faster overall reading / uploading a (large) file, consider increasing the size of bufferSize
(Source.DefaultBufSize
set to 2048
), for instance as follows,
val file = new java.io.File("myFilename")io.Source.fromFile(file, bufferSize = Source.DefaultBufSize * 2)
Note Source.scala. For further discussion see Scala fast text file read and upload to memory.