Bug 1534209 - Do not readahead when PrefetchVirtualMemory is not available. r=aklotz
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 18 Mar 2019 22:39:44 +0000
changeset 464943 33b7a55cdc2012a8004e02e9daeaefa5198ccf5b
parent 464942 770808176c5c92e877b7f5fbf1ad4a4686bd2d6e
child 464944 38d13d13f7e7cd7072d69eca90745b5c7ece30c1
push id112486
push useropoprus@mozilla.com
push dateTue, 19 Mar 2019 16:41:04 +0000
treeherdermozilla-inbound@ee866fb50236 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz
bugs1534209
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534209 - Do not readahead when PrefetchVirtualMemory is not available. r=aklotz Re-enabling the PGO jarlog, which was unexpectedly disabled since Firefox 56 showed a regression on Windows 7, due to the use of mozilla::ReadAhead, which on Windows 7 does explicit I/O on the caller thread. While there may be some benefit from doing so, evidence says the opposite, which is presumably due to the amount of data being loaded not being relevant in every case: the jarlog is gathered from a first-run, which has a different jar-loading profile from subsequent runs of Firefox. While we may want to improve the situation later on, the immediate thing we can do is stop doing this explicit read, while keeping the OS readahead hints on other platforms, which don't imply explicit I/O. All this does is effectively get us back to the same state as if jarlogs were disabled like it was since Firefox 56, for Windows 7 only. aFd not being used anymore, the code could be cleaned up a lot, but we may reintroduce the readahead later, so keep the status quo for now. Differential Revision: https://phabricator.services.mozilla.com/D23642
modules/libjar/nsZipArchive.cpp
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -668,21 +668,16 @@ nsresult nsZipArchive::BuildFileList(PRF
         // enough struct anyways.
         struct {
           PVOID VirtualAddress;
           SIZE_T NumberOfBytes;
         } entry;
         entry.VirtualAddress = const_cast<uint8_t *>(startp);
         entry.NumberOfBytes = readaheadLength;
         prefetchVirtualMemory(GetCurrentProcess(), 1, &entry, 0);
-        readaheadLength = 0;
-      }
-      if (readaheadLength && aFd) {
-        HANDLE hFile = (HANDLE)PR_FileDesc2NativeHandle(aFd);
-        mozilla::ReadAhead(hFile, 0, readaheadLength);
       }
 #endif
     }
   } else {
     for (buf = endp - ZIPEND_SIZE; buf > startp; buf--) {
       if (xtolong(buf) == ENDSIG) {
         centralOffset = xtolong(((ZipEnd *)buf)->offset_central_dir);
         break;