Aggressive performance opts.

This commit is contained in:
Young Hahn
2012-01-22 17:29:30 -05:00
parent fca703f63e
commit 236745daf0
2 changed files with 11 additions and 8 deletions

View File

@@ -392,7 +392,7 @@ MBTiles.prototype.startWriting = function(callback) {
if (!this._isWritable) {
this._isWritable = 1;
this._clearCaches();
this._db.run('PRAGMA synchronous=OFF', callback);
this._db.exec('PRAGMA journal_mode = OFF; PRAGMA locking_mode = EXCLUSIVE; PRAGMA synchronous=OFF; PRAGMA cache_size = 400000;', callback);
} else {
this._isWritable++;
return callback(null);
@@ -505,7 +505,7 @@ MBTiles.prototype.stopWriting = function(callback) {
this._commit(function(err) {
if (err) return callback(err);
if (!mbtiles._isWritable) {
mbtiles._db.run('PRAGMA synchronous=NORMAL', callback);
mbtiles._db.exec('PRAGMA journal_mode = DELETE; PRAGMA locking_mode = NORMAL; PRAGMA synchronous=NORMAL; PRAGMA cache_size=2000;', callback);
} else {
return callback(null);
}