Hello,
thanks for the reply. I have updated my while loop to use the following logic:
var buffer = Data(count: 4 * 1024 * 1024)
let fd = open(fileUrl.path, O_RDONLY)
if fcntl(fd, F_NOCACHE, 1) == -1 { return }
while Date.now.timeIntervalSince1970 - startTime < 5.0
{
buffer.withUnsafeMutableBytes
{
ptr in
let amount = read(fd, ptr.baseAddress, ptr.count)
self.readData += UInt64(amount)
self.totalReadData += UInt64(amount)
}
lseek(fd, 0, SEEK_SET)
}
close(fd)
The calculated speed goes up to almost 16GB/s. I tried moving the open and close calls directly into the while loop. Although this slows down the logic (as one would expect), the speed is still roughly 8GB/s.
Regards,
Sascha
Topic:
App & System Services
SubTopic:
Core OS
Tags: