Skip to content

Commit

Permalink
Tune SQLite build for redbean (#97)
Browse files Browse the repository at this point in the history
redbean lua handlers that perform sql queries can do 400k qps.

We now use a separate compile-time options for SQLite, when building the
SQLite shell versus building the production web serving code. It doesn't
seem appropriate for something like redbean to include backups, progress
callbacks, query completion, profiling, EXPLAIN, ALTER, ANALYZE, VACUUM,
etc. since those tasks are better left to the sqlite3.com shell program.

Lua SQLite pointer APIs have been removed since we're not using threads.
The Lua APIs for installing update / commit / rollback hooks are removed
due to a general sense of disagreement and an overall lack of comfort.

Full-Text Search and R*Tree are as large as the rest of SQLite combined.
Turning those off keeps redbean under 1mb when built for MODE=tiny which
is nice for marketing purposes.

If you need something that was removed, file an issue, and we'll add it.
  • Loading branch information
jart committed Jun 10, 2021
1 parent eb08b9f commit 88806b7
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 1,284 deletions.
2 changes: 1 addition & 1 deletion libc/str/strncasecmp16.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ int strncasecmp16(const char16_t *a, const char16_t *b, size_t n) {
int x, y;
size_t i = 0;
if (!n-- || a == b) return 0;
while ((x = tolower(a[i])) == (y = tolower(b[i])) && b[i] && i < n) ++i;
while ((x = towlower(a[i])) == (y = towlower(b[i])) && b[i] && i < n) ++i;
return x - y;
}
2 changes: 2 additions & 0 deletions third_party/sqlite3/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,9 @@ Expr *sqlite3ExprForVectorField(
}else{
if( pVector->op==TK_VECTOR ) pVector = pVector->x.pList->a[iField].pExpr;
pRet = sqlite3ExprDup(pParse->db, pVector, 0);
#ifndef SQLITE_OMIT_ALTERTABLE
sqlite3RenameTokenRemap(pParse, pRet, pVector);
#endif
}
return pRet;
}
Expand Down
Loading

0 comments on commit 88806b7

Please sign in to comment.