You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am making some calculation on SA array and write the transformation to file "fname" acording following methods.
But why _writeIOBulk2 is slower as _writeIOBulk and _writeIOJava is 2x slower as _writeIO i cant understand . And anyway what is the fastest and cleanest way to make this operation :
acording some Iterated object write anther Iterated object in file .
[info] benchmark us linear runtime
[info] _writeIO 58.8 =
[info] _writeIOBulk 191834.4 =========
[info] _writeIOBulk2 604051.9 ==============================
[info] _writeIOJava 99.9 =
I am making some calculation on SA array and write the transformation to file "fname" acording following methods.
But why _writeIOBulk2 is slower as _writeIOBulk and _writeIOJava is 2x slower as _writeIO i cant understand . And anyway what is the fastest and cleanest way to make this operation :
acording some Iterated object write anther Iterated object in file .
var SA = new ArrayInt
var chr = new ArrayByte
def writeIOJava(fname:String):Unit = {
var output = new java.io.FileOutputStream(fname)
val bwt= new ArrayByte
for ( i<- 0 until n) {
val pIdx = SA(i)-1
bwt(i) = chr(if (pIdx >= 0) pIdx else pIdx+n ).toByte
}
output.write(bwt)
output.close()
}
def writeIO(fname:String):Unit = {
val output:Output = Resource.fromFile(fname)
val bwt= new ArrayByte
for ( i<- 0 until n) {
val pIdx = SA(i)-1
bwt(i) = chr(if (pIdx >= 0) pIdx else pIdx+n ).toByte
}
output.write(bwt)
}
def writeIOBulk(fname:String):Unit = {
val output:Output = Resource.fromFile(fname)
//val bwt= new ArrayByte
for ( i<- 0 until n) {
val pIdx = SA(i)-1
output.write(chr(if (pIdx >= 0) pIdx else pIdx+n ).toByte)
}
}
def writeIOBulk2(fname:String):Unit = {
val output = Path.fromString(fname).outputStream(WriteTruncate:_*)
//val bwt= new ArrayByte
for ( i<- 0 until n) {
val pIdx = SA(i)-1
output.write(chr(if (pIdx >= 0) pIdx else pIdx+n ).toByte)
}
}
The text was updated successfully, but these errors were encountered: