When mmap is used, do an madvise(MADV_SEQUENTIAL) to make things

go much more quickly when file input is really done.  Of course, the
fully cached case will make no difference.
This commit is contained in:
John Dyson 1996-12-11 05:20:20 +00:00
parent b68a757139
commit 2ae09ad871
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=20312

View File

@ -74,9 +74,12 @@ c_regular(fd1, file1, skip1, len1, fd2, file2, skip2, len2)
if ((p1 = (u_char *)mmap(NULL,
(size_t)length, PROT_READ, 0, fd1, skip1)) == (u_char *)-1)
err(ERR_EXIT, "%s", file1);
madvise(p1, length, MADV_SEQUENTIAL);
if ((p2 = (u_char *)mmap(NULL,
(size_t)length, PROT_READ, 0, fd2, skip2)) == (u_char *)-1)
err(ERR_EXIT, "%s", file2);
madvise(p2, length, MADV_SEQUENTIAL);
dfound = 0;
for (byte = line = 1; length--; ++p1, ++p2, ++byte) {