src/lib/libmd/mdXhl.c MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len) { unsigned char buffer[BUFSIZ]; where BUFSIZE is 1024 from stdio.h This will make lots of read(2) syscalls. All utilities depend on libmd, including md5(1) and sha256(1), are affected. ============== For example, on my system, (file content is already cached in ram) $ du -h file.bin 4.9G file.bin $ time md5 file.bin MD5 (file.bin) = 422bb7e6759dee9dd1af940f9d9db5ab real 0m31.848s user 0m11.500s sys 0m19.526s Notice that 19.526s spend in sys. You could also verify the read size is 1024 using truss(1) $ truss md5 file.bin ... read(3,"^3fEiRA\M^S\^]\M-Rf\M-7\M-E\M-g"...,1024) = 1024 (0x400) ... ============== If modified buffer[] to larger, say 1MB, md5(1) becomes much faster. $ time md5 file.bin MD5 (file.bin) = 422bb7e6759dee9dd1af940f9d9db5ab real 0m14.369s user 0m11.220s sys 0m1.933s
Assigning this to jmg, since he increased the buffer size in r285324.
batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.