Skip to content

Commit

Permalink
Tweaks, docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruces committed Mar 25, 2024
1 parent d6db364 commit bd1e2fa
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/repro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ mkdir -p tools/
wait

sqlite3/download.sh # Download SQLite
embed/build.sh # Build WASM
embed/build.sh # Build Wasm
git diff --exit-code # Check diffs
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Go module `github.com/ncruces/go-sqlite3` is `cgo`-free [SQLite](https://sqlite.
It provides a [`database/sql`](https://pkg.go.dev/database/sql) compatible driver,
as well as direct access to most of the [C SQLite API](https://sqlite.org/cintro.html).

It wraps a [WASM](https://webassembly.org/) build of SQLite, and uses [wazero](https://wazero.io/) as the runtime.\
It wraps a [Wasm](https://webassembly.org/) build of SQLite, and uses [wazero](https://wazero.io/) as the runtime.\
Go, wazero and [`x/sys`](https://pkg.go.dev/golang.org/x/sys) are the _only_ runtime dependencies.

### Packages
Expand Down Expand Up @@ -77,7 +77,7 @@ This has benefits, but also comes with some drawbacks.

#### Write-Ahead Logging

Because WASM does not support shared memory,
Because Wasm does not support shared memory,
[WAL](https://sqlite.org/wal.html) support is [limited](https://sqlite.org/wal.html#noshm).

To work around this limitation, SQLite is [patched](sqlite3/locking_mode.patch)
Expand Down Expand Up @@ -131,7 +131,7 @@ on Linux, macOS, Windows and FreeBSD.
Perfomance of the [`database/sql`](https://pkg.go.dev/database/sql) driver is
[competitive](https://github.com/cvilsmeier/go-sqlite-bench) with alternatives.

The WASM and VFS layers are also tested by running SQLite's
The Wasm and VFS layers are also tested by running SQLite's
[speedtest1](https://github.com/sqlite/sqlite/blob/master/test/speedtest1.c).

### Alternatives
Expand Down
4 changes: 2 additions & 2 deletions embed/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Embeddable WASM build of SQLite
# Embeddable Wasm build of SQLite

This folder includes an embeddable WASM build of SQLite 3.45.1 for use with
This folder includes an embeddable Wasm build of SQLite 3.45.1 for use with
[`github.com/ncruces/go-sqlite3`](https://pkg.go.dev/github.com/ncruces/go-sqlite3).

The following optional features are compiled in:
Expand Down
8 changes: 4 additions & 4 deletions sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import (
"github.com/tetratelabs/wazero/api"
)

// Configure SQLite WASM.
// Configure SQLite Wasm.
//
// Importing package embed initializes these
// Importing package embed initializes [Binary]
// with an appropriate build of SQLite:
//
// import _ "github.com/ncruces/go-sqlite3/embed"
var (
Binary []byte // WASM binary to load.
Binary []byte // Wasm binary to load.
Path string // Path to load the binary from.

RuntimeConfig wazero.RuntimeConfig
Expand Down Expand Up @@ -274,7 +274,7 @@ func (a *arena) new(size uint64) uint32 {
}

func (a *arena) bytes(b []byte) uint32 {
if b == nil {
if (*[0]byte)(b) == nil {
return 0
}
ptr := a.new(uint64(len(b)))
Expand Down
4 changes: 2 additions & 2 deletions sqlite3/sqlite_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
#define SQLITE_ENABLE_ATOMIC_WRITE
#define SQLITE_ENABLE_BATCH_ATOMIC_WRITE

// Because WASM does not support shared memory,
// SQLite disables WAL for WASM builds.
// Because Wasm does not support shared memory,
// SQLite disables WAL for Wasm builds.
// We patch SQLite to use exclusive locking mode instead.
// https://sqlite.org/wal.html#noshm
#undef SQLITE_OMIT_WAL
Expand Down

0 comments on commit bd1e2fa

Please sign in to comment.