aherbert commented on PR #229: URL: https://github.com/apache/commons-codec/pull/229#issuecomment-1880884744
Note: The `DigestTestUtils` and `MessageDigestAlgorithmsTest` classes are creating a random `byte[]` and writing it to two files for every method. If this behaviour is changed from `Before/AfterEach` to `Before/AfterAll` (with use of static data) then I observe an speed-up of 20%. Since the data is non-destructively used, then a simple switch to make the `testFile` and `testRandomAccessFile` the same saves 10% by requiring 1 less file write per test fixture. Given the limited impact of optimising the test resources, the major runtime of the test is the actual digest of the megabyte of random data. The internal buffer size in `DigestUtils` is 1024. So if the test data is changed then it should be larger than this size. The suggested 32*32 (1024) is too small to require looping within `DigestUtils` when digesting a `FileChannel` or `InputStream`. I would suggest updating the tests to use a single source of random data created once. The size can be reduced to improve speed but it should not compromise testing of the digest algorithms. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
