/ Changes On Branch faster-memory-barrier
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch faster-memory-barrier Excluding Merge-Ins

This is equivalent to a diff from 1d21295707 to df66fec9bc

2019-02-08
22:34
Small performance improvement and size reduction for pageFindSlot() - the routine in btree.c that locates a free slot for a cell on a btree page. (check-in: 1969372ac7 user: drh tags: trunk)
20:55
Use a fast compiler-provided memory barrier exclusively, if such a memory barrier is available. (Leaf check-in: df66fec9bc user: drh tags: faster-memory-barrier)
17:28
Further simplifications to sqlite3VdbeMemSetStr(). (check-in: 1d21295707 user: drh tags: trunk)
15:59
Change the sqlite3VdbeMemGrow() routine so that it no longer guarantees a minimum size of 32 bytes. That minimum is no longer required, and without the extra check for the minimum size, the routine runs faster. (check-in: 5c499da8a4 user: drh tags: trunk)

Changes to src/mutex_unix.c.

89
90
91
92
93
94
95

96
97
98
99
100
101
102
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103







+







** where SQLite is compiled without mutexes.
*/
void sqlite3MemoryBarrier(void){
#if defined(SQLITE_MEMORY_BARRIER)
  SQLITE_MEMORY_BARRIER;
#elif defined(__GNUC__) && GCC_VERSION>=4001000
  __sync_synchronize();
# define sqlite3MemoryBarrier_IS_RELIABLE 1
#endif
}

/*
** Initialize and deinitialize the mutex subsystem.
*/
static int pthreadMutexInit(void){ return SQLITE_OK; }

Changes to src/mutex_w32.c.

83
84
85
86
87
88
89

90
91

92
93
94
95
96
97
98
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100







+


+







** compiled without mutexes (SQLITE_THREADSAFE=0).
*/
void sqlite3MemoryBarrier(void){
#if defined(SQLITE_MEMORY_BARRIER)
  SQLITE_MEMORY_BARRIER;
#elif defined(__GNUC__)
  __sync_synchronize();
# define sqlite3MemoryBarrier_IS_RELIABLE 1
#elif MSVC_VERSION>=1300
  _ReadWriteBarrier();
# define sqlite3MemoryBarrier_IS_RELIABLE 1
#elif defined(MemoryBarrier)
  MemoryBarrier();
#endif
}

/*
** Initialize and deinitialize the mutex subsystem.

Changes to src/os_unix.c.

4889
4890
4891
4892
4893
4894
4895

4896
4897

4898
4899
4900
4901
4902
4903
4904
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906







+


+







  sqlite3_file *fd                /* Database file holding the shared memory */
){
  UNUSED_PARAMETER(fd);
  sqlite3MemoryBarrier();         /* compiler-defined memory barrier */
  assert( fd->pMethods->xLock==nolockLock 
       || unixFileMutexNotheld((unixFile*)fd) 
  );
#ifndef sqlite3MemoryBarrier_IS_RELIABLE
  unixEnterMutex();               /* Also mutex, for redundancy */
  unixLeaveMutex();
#endif
}

/*
** Close a connection to shared-memory.  Delete the underlying 
** storage if deleteFlag is true.
**
** If there is no shared memory associated with the connection then this

Changes to src/os_win.c.

4170
4171
4172
4173
4174
4175
4176

4177
4178

4179
4180
4181
4182
4183
4184
4185
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187







+


+







** any load or store begun after the barrier.
*/
static void winShmBarrier(
  sqlite3_file *fd          /* Database holding the shared memory */
){
  UNUSED_PARAMETER(fd);
  sqlite3MemoryBarrier();   /* compiler-defined memory barrier */
#ifndef sqlite3MemoryBarrier_IS_RELIABLE
  winShmEnterMutex();       /* Also mutex, for redundancy */
  winShmLeaveMutex();
#endif
}

/*
** This function is called to obtain a pointer to region iRegion of the
** shared-memory associated with the database file fd. Shared-memory regions
** are numbered starting from zero. Each shared-memory region is szRegion
** bytes in size.