Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | In kvtest.c, use stat() instead of fseek()/ftell() to determine the size of a BLOB to be read directly from disk. This makes the pile-of-files database more competative against SQLite. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a7dca29f03e037fe71cc600db97f8058 |
User & Date: | drh 2016-12-29 17:25:06.872 |
Context
2016-12-29
| ||
19:48 | Fix harmless compiler warnings in the command-line shell and in Lemon. (check-in: afcdc4a60e user: drh tags: trunk) | |
17:25 | In kvtest.c, use stat() instead of fseek()/ftell() to determine the size of a BLOB to be read directly from disk. This makes the pile-of-files database more competative against SQLite. (check-in: a7dca29f03 user: drh tags: trunk) | |
16:58 | Add the kvtest.c test program used to show that it is many times faster to read thumbnail and similar BLOBs out of an SQLite database than it is to read them as separate files from the filesystem. (check-in: 8074d59cf1 user: drh tags: trunk) | |
Changes
Changes to test/kvtest.c.
︙ | |||
100 101 102 103 104 105 106 107 108 109 110 111 112 113 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | + | #ifndef _WIN32 # include <unistd.h> #else /* Provide Windows equivalent for the needed parts of unistd.h */ # include <io.h> # define R_OK 2 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) # define access _access #endif /* ** Show thqe help text and quit. |
︙ | |||
149 150 151 152 153 154 155 156 157 158 159 160 161 162 | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | + + + + + + + + + + + + + + | memset(&x, 0, sizeof(x)); rc = stat(zPath, &x); if( rc<0 ) return PATH_OTHER; if( S_ISDIR(x.st_mode) ) return PATH_DIR; if( (x.st_size%512)==0 ) return PATH_DB; return PATH_OTHER; } /* ** Return the size of a file in bytes. Or return -1 if the ** named object is not a regular file or does not exist. */ static sqlite3_int64 fileSize(const char *zPath){ struct stat x; int rc; memset(&x, 0, sizeof(x)); rc = stat(zPath, &x); if( rc<0 ) return -1; if( !S_ISREG(x.st_mode) ) return -1; return x.st_size; } /* ** A Pseudo-random number generator with a fixed seed. Use this so ** that the same sequence of "random" numbers are generated on each ** run, for repeatability. */ static unsigned int randInt(void){ |
︙ | |||
311 312 313 314 315 316 317 | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | - - - - + + + + + + + + - - - - + - | ** from the file before the buffer is returned. This byte is not included in ** the final value of (*pnByte), if applicable. ** ** NULL is returned if any error is encountered. The final value of *pnByte ** is undefined in this case. */ static unsigned char *readFile(const char *zName, int *pnByte){ |
︙ |