Skip to content

Commit

Permalink
perf: Don't use the useWritemap option if we know we don't need it
Browse files Browse the repository at this point in the history
  • Loading branch information
FUDCo committed May 20, 2020
1 parent d4f5f0f commit c272e43
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/swing-store-lmdb/lmdbSwingStore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'fs';
import os from 'os';
import path from 'path';

import lmdb from 'node-lmdb';
Expand Down Expand Up @@ -27,7 +28,12 @@ function makeSwingStore(dirPath, forceReset = false) {
lmdbEnv.open({
path: dirPath,
mapSize: 2 * 1024 * 1024 * 1024, // XXX need to tune this
useWritemap: true,
// Turn off useWritemap on the Mac. The userWritemap option is currently
// required for LMDB to function correctly on Linux running under WSL, but
// we don't yet have a convenient recipe to probe our environment at
// runtime to distinguish that species of Linux from the others. For now
// we're running our benchmarks on Mac, so this will do for the time being.
useWritemap: os.platform() !== 'darwin',
});

let dbi = lmdbEnv.openDbi({
Expand Down

0 comments on commit c272e43

Please sign in to comment.