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
Reading the file attributes is very slow compared to Windows and Linux.
In my example I add the size of all files in a specific directory. The directory contains 30.000 files with 32KB. On Windows it runs 135 ms and on AS400 1050 ms. That is 10x faster!
Other methods like File.listFiles() on AS400 are faster than Windows, but they still take 1000+ ms. Also tested IFSFile.listFiles() and SQL IFS access. So it would be nice if only accessing the file attributes would be faster.
# example: calculate file size in directory
private long walkWithJava7(String dirPath) throws IOException
{
AtomicLong size = new AtomicLong(0);
Path folder = Paths.get(dirPath);
Files.walkFileTree(folder, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
{
//Use attributes - creating File object is slow!
if(attrs.isRegularFile()) {
size.addAndGet(attrs.size());
}
return FileVisitResult.CONTINUE;
}
});
return size.longValue();
}
The text was updated successfully, but these errors were encountered:
Reading the file attributes is very slow compared to Windows and Linux.
In my example I add the size of all files in a specific directory. The directory contains 30.000 files with 32KB. On Windows it runs 135 ms and on AS400 1050 ms. That is 10x faster!
Other methods like File.listFiles() on AS400 are faster than Windows, but they still take 1000+ ms. Also tested IFSFile.listFiles() and SQL IFS access. So it would be nice if only accessing the file attributes would be faster.
The text was updated successfully, but these errors were encountered: