diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 17:21:03 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 16:25:15 +0000 |
commit | c551f43206405019121bd2b2c93714319a0a3300 (patch) | |
tree | 1f48c30631c421fd4bbb3c36da20183c8a2ed7d7 /chromium/sql | |
parent | 7961cea6d1041e3e454dae6a1da660b453efd238 (diff) | |
download | qtwebengine-chromium-c551f43206405019121bd2b2c93714319a0a3300.tar.gz |
BASELINE: Update Chromium to 79.0.3945.139
Change-Id: I336b7182fab9bca80b709682489c07db112eaca5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/sql')
-rw-r--r-- | chromium/sql/database.cc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/chromium/sql/database.cc b/chromium/sql/database.cc index 964fd61e87e..7f7bcd2a830 100644 --- a/chromium/sql/database.cc +++ b/chromium/sql/database.cc @@ -355,17 +355,20 @@ void Database::Preload() { base::Optional<base::ScopedBlockingCall> scoped_blocking_call; InitScopedBlockingCall(&scoped_blocking_call); - // The constructor and set_page_size() ensure that page_size_ is never zero. - const int page_size = page_size_; - DCHECK(page_size); - - // Use local settings if provided, otherwise use documented defaults. The - // actual results could be fetching via PRAGMA calls. - sqlite3_int64 preload_size = page_size * (cache_size_ ? cache_size_ : 2000); - if (preload_size < 1) - return; - - base::PreReadFile(DbPath(), /*is_executable=*/false, preload_size); + // Maximum number of bytes that will be prefetched from the database. + // + // This limit is very aggressive. Here are the trade-offs involved. + // 1) Accessing bytes that weren't preread is very expensive on + // performance-critical databases, so the limit must exceed the expected + // sizes of feature databases. + // 2) On some platforms (Windows 7 and, currently, macOS), base::PreReadFile() + // falls back to a synchronous read, and blocks until the entire file is + // read into memory. So, there's a tangible cost to reading data that would + // get evicted before base::PreReadFile() completes. This cost needs to be + // balanced with the benefit reading the entire database at once, and + // avoiding seeks on spinning disks. + constexpr int kPreReadSize = 128 * 1024 * 1024; // 128 MB + base::PreReadFile(DbPath(), /*is_executable=*/false, kPreReadSize); } // SQLite keeps unused pages associated with a database in a cache. It asks |