RFR: 8294437: java/nio/channels/FileChannel tests slow on Windows

Brian Burkhalter bpb at openjdk.org
Wed Sep 28 19:53:21 UTC 2022


On Wed, 28 Sep 2022 10:58:43 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> Please review this test-only change that improves the execution speed of a few FileChannel tests:
> - Transfer2GPlus, Transfer4GBFile, and TransferTo6GBFile were modified to use sparse files. Their speed is now consistent across platforms, provided that the platform / filesystem supports sparse files.
> - LargeMapTest was rewritten to use sparse files, and to more precisely target the issue it was written to detect. In my tests it still crashed with EXCEPTION_ACCESS_VIOLATION when JDK-8286637 was reverted.
> - MapTest: repetition was removed from `testForce` method; I'm not sure what issues it was supposed to catch, but at far as I can tell, it was only triggering timeouts, see [JDK-8289526](https://bugs.openjdk.org/browse/JDK-8289526), [JDK-8224480](https://bugs.openjdk.org/browse/JDK-8224480)

Overall I don’t see any problems aside from the copyright years which I assume you will fix before integrating. It’s good that you removed `RandomAccessFile` in one place. It might be good to try to remove all `java.io` uses where possible, e.g., not `deleteOnExit()`. Also, instead of creating a temporary file and then deleting it, maybe something else could be done. For example, creating a temporary directory and then creating a file with a hard-coded name within it. Or using `Random` to create a file name and using the `REPLACE_EXISTING` open option. Another thought would be to add a method `createSparseTempFile()` or something to `lib/util/FileUtils`.

-------------

PR: https://git.openjdk.org/jdk/pull/10464


More information about the nio-dev mailing list