summaryrefslogtreecommitdiffstats
path: root/sql/connection.h
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-21 00:42:34 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-21 00:42:34 +0000
commit8ada10f0861a51b508b1c804b899f547b0132457 (patch)
tree69ce9765f6d266e20e82428f0b1b12c6dfaceded /sql/connection.h
parente68fafe04d29810cebe8d25554863b0cae4c1356 (diff)
downloadchromium_src-8ada10f0861a51b508b1c804b899f547b0132457.zip
chromium_src-8ada10f0861a51b508b1c804b899f547b0132457.tar.gz
chromium_src-8ada10f0861a51b508b1c804b899f547b0132457.tar.bz2
[sql] Rewrite Connection::Preload() in terms of file reading.
r204860 rewrote sqlite3_preload() to read the file without placing the data in the SQLite cache to improve memory footprint. No reports of performance degradation ensued. This CL rewrites Connection::Preload() to use the SQLite file handle to read the data, and backs out the preload-cache.patch from third_party/sqlite/. BUG=243949 Review URL: https://codereview.chromium.org/116443004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sql/connection.h')
-rw-r--r--sql/connection.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/sql/connection.h b/sql/connection.h
index 54c3f8b..5f11e44 100644
--- a/sql/connection.h
+++ b/sql/connection.h
@@ -187,19 +187,17 @@ class SQL_EXPORT Connection {
// an uninitialized or already-closed database.
void Close();
- // Pre-loads the first <cache-size> pages into the cache from the file.
- // If you expect to soon use a substantial portion of the database, this
- // is much more efficient than allowing the pages to be populated organically
- // since there is no per-page hard drive seeking. If the file is larger than
- // the cache, the last part that doesn't fit in the cache will be brought in
- // organically.
+ // Reads the first <cache-size>*<page-size> bytes of the file to prime the
+ // filesystem cache. This can be more efficient than faulting pages
+ // individually. Since this involves blocking I/O, it should only be used if
+ // the caller will immediately read a substantial amount of data from the
+ // database.
//
- // This function assumes your class is using a meta table on the current
- // database, as it openes a transaction on the meta table to force the
- // database to be initialized. You should feel free to initialize the meta
- // table after calling preload since the meta table will already be in the
- // database if it exists, and if it doesn't exist, the database won't
- // generally exist either.
+ // TODO(shess): Design a set of histograms or an experiment to inform this
+ // decision. Preloading should almost always improve later performance
+ // numbers for this database simply because it pulls operations forward, but
+ // if the data isn't actually used soon then preloading just slows down
+ // everything else.
void Preload();
// Try to trim the cache memory used by the database. If |aggressively| is