Commit a5870895 authored by Marco Bonardo's avatar Marco Bonardo
Browse files

Bug 1313021 - Use a MEMORY SQLITE_TEMP_STORE on Android and 64bit builds. r=asuth

MozReview-Commit-ID: IeXOY3tTStq

--HG--
extra : rebase_source : a5457303a07751cc9d3c1861630636b15cce8a9f
parent 007ffb1e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -85,6 +85,17 @@ DEFINES['SQLITE_OMIT_DEPRECATED'] = True
DEFINES['SQLITE_OMIT_BUILTIN_TEST'] = True
DEFINES['SQLITE_OMIT_DECLTYPE'] = True

# Try to use a MEMORY temp store when possible. That allows for better
# performance and doesn't suffer from a full separate tmp partition.
# Exclude 32bit platforms due to address space fragmentation issues.
# System Sqlite is managed through a PRAGMA instead.
if CONFIG['OS_TARGET'] == 'Android':
    # On Android there's no tmp partition, so always use a MEMORY temp store.
    DEFINES['SQLITE_TEMP_STORE'] = 3
elif CONFIG['HAVE_64BIT_BUILD']:
    # On 64bit platforms default to a MEMORY temp store for performance.
    DEFINES['SQLITE_TEMP_STORE'] = 2

# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
    CFLAGS += [
+6 −0
Original line number Diff line number Diff line
@@ -107,6 +107,12 @@ if CONFIG['MOZ_MEMORY'] and (not CONFIG['MOZ_SYSTEM_SQLITE']
# will need to change it here as well.
DEFINES['SQLITE_MAX_LIKE_PATTERN_LENGTH'] = 50000

# See Sqlite moz.build for reasoning about TEMP_STORE.
# For system sqlite we cannot use the compile time option, so we use a pragma.
if CONFIG['MOZ_SYSTEM_SQLITE'] and (CONFIG['OS_TARGET'] == 'Android'
                                    or CONFIG['HAVE_64BIT_BUILD']):
    DEFINES['MOZ_MEMORY_TEMP_STORE_PRAGMA'] = True

LOCAL_INCLUDES += [
    '/db/sqlite3/src',
    '/dom/base',
+4 −0
Original line number Diff line number Diff line
@@ -762,6 +762,10 @@ Connection::initializeInternal()
    return convertResultCode(srv);
  }

#if defined(MOZ_MEMORY_TEMP_STORE_PRAGMA)
  (void)ExecuteSimpleSQL(NS_LITERAL_CSTRING("PRAGMA temp_store = 2;"));
#endif

  // Register our built-in SQL functions.
  srv = registerFunctions(mDBConn);
  if (srv != SQLITE_OK) {