@op-engineering/op-sqlite 2.0.9 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/cpp/bindings.cpp +5 -8
- package/cpp/bridge.cpp +3 -0
- package/op-sqlite.podspec +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Created by [@ospfranco](https://twitter.com/ospfranco). **Please consider Sponso
|
|
|
16
16
|
|
|
17
17
|
## Benchmarks
|
|
18
18
|
|
|
19
|
-
You can find the [benchmarking code in the example app](https://github.com/OP-Engineering/op-sqlite/blob/main/example/src/Database.ts#L44).
|
|
19
|
+
You can find the [benchmarking code in the example app](https://github.com/OP-Engineering/op-sqlite/blob/main/example/src/Database.ts#L44). This is run using the `OP_SQLITE_PERF` flag which in turns disables some old and unused features of sqlite to squeeze the last drop of performance.
|
|
20
20
|
|
|
21
21
|

|
|
22
22
|
|
|
@@ -104,7 +104,7 @@ const largeDb = open({
|
|
|
104
104
|
});
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
#
|
|
107
|
+
# Performance
|
|
108
108
|
|
|
109
109
|
op-sqlite is already the fastest solution it can be, but it doesn't mean you cannot tweak SQLite to be faster (at the cost of some disadvantages). One possible tweak is turning on [Memory Mapping](https://www.sqlite.org/mmap.html). It allows to read/write to/from the disk without going through the kernel. However, if your queries throw an error your application might crash.
|
|
110
110
|
|
|
@@ -129,6 +129,14 @@ If you use [prepared statements](#prepared-statements) plus memory mapping and s
|
|
|
129
129
|
|
|
130
130
|

|
|
131
131
|
|
|
132
|
+
# Perf flag
|
|
133
|
+
|
|
134
|
+
You can turn on the performance flag to tweak all possible performance enhancing compilation flags, this greatly affects performance of sqlite itself
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
OP_SQLITE_PERF=1 npx pod-install
|
|
138
|
+
```
|
|
139
|
+
|
|
132
140
|
# SQLite Gotchas
|
|
133
141
|
|
|
134
142
|
## Strictness
|
package/cpp/bindings.cpp
CHANGED
|
@@ -38,7 +38,6 @@ void clearState() {
|
|
|
38
38
|
sqlite_close_all();
|
|
39
39
|
// We then join all the threads before the context gets invalidated
|
|
40
40
|
pool.restartPool();
|
|
41
|
-
|
|
42
41
|
updateHooks.clear();
|
|
43
42
|
commitHooks.clear();
|
|
44
43
|
rollbackHooks.clear();
|
|
@@ -422,9 +421,8 @@ void install(jsi::Runtime &rt,
|
|
|
422
421
|
|
|
423
422
|
auto updateHook = HOSTFN("updateHook", 2) {
|
|
424
423
|
if (sizeof(args) < 2) {
|
|
425
|
-
throw std::runtime_error(
|
|
426
|
-
|
|
427
|
-
"dbName and callback needed");
|
|
424
|
+
throw std::runtime_error("[op-sqlite][updateHook] Incorrect parameters: "
|
|
425
|
+
"dbName and callback needed");
|
|
428
426
|
return {};
|
|
429
427
|
}
|
|
430
428
|
|
|
@@ -481,9 +479,8 @@ void install(jsi::Runtime &rt,
|
|
|
481
479
|
|
|
482
480
|
auto commitHook = HOSTFN("commitHook", 2) {
|
|
483
481
|
if (sizeof(args) < 2) {
|
|
484
|
-
throw std::runtime_error(
|
|
485
|
-
|
|
486
|
-
"dbName and callback needed");
|
|
482
|
+
throw std::runtime_error("[op-sqlite][commitHook] Incorrect parameters: "
|
|
483
|
+
"dbName and callback needed");
|
|
487
484
|
return {};
|
|
488
485
|
}
|
|
489
486
|
|
|
@@ -508,7 +505,7 @@ void install(jsi::Runtime &rt,
|
|
|
508
505
|
auto rollbackHook = HOSTFN("rollbackHook", 2) {
|
|
509
506
|
if (sizeof(args) < 2) {
|
|
510
507
|
throw std::runtime_error(
|
|
511
|
-
"[op-sqlite][
|
|
508
|
+
"[op-sqlite][rollbackHook] Incorrect parameters: "
|
|
512
509
|
"dbName and callback needed");
|
|
513
510
|
return {};
|
|
514
511
|
}
|
package/cpp/bridge.cpp
CHANGED
package/op-sqlite.podspec
CHANGED
|
@@ -12,14 +12,14 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.license = package["license"]
|
|
13
13
|
s.authors = package["author"]
|
|
14
14
|
|
|
15
|
-
s.platforms = { :ios => "
|
|
15
|
+
s.platforms = { :ios => "13.0", :osx => "10.15" }
|
|
16
16
|
s.source = { :git => "https://github.com/op-engineering/op-sqlite.git", :tag => "#{s.version}" }
|
|
17
17
|
|
|
18
18
|
s.pod_target_xcconfig = {
|
|
19
19
|
:GCC_PREPROCESSOR_DEFINITIONS => "HAVE_FULLFSYNC=1",
|
|
20
20
|
:WARNING_CFLAGS => "-Wno-shorten-64-to-32 -Wno-comma -Wno-unreachable-code -Wno-conditional-uninitialized -Wno-deprecated-declarations",
|
|
21
21
|
:USE_HEADERMAP => "No",
|
|
22
|
-
:CLANG_CXX_LANGUAGE_STANDARD => "c++17"
|
|
22
|
+
:CLANG_CXX_LANGUAGE_STANDARD => "c++17",
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
s.header_mappings_dir = "cpp"
|
|
@@ -37,5 +37,15 @@ Pod::Spec.new do |s|
|
|
|
37
37
|
s.exclude_files = "cpp/sqlite3.c", "cpp/sqlite3.h"
|
|
38
38
|
s.library = "sqlite3"
|
|
39
39
|
end
|
|
40
|
+
|
|
41
|
+
if ENV['OP_SQLITE_PERF'] == '1' then
|
|
42
|
+
s.pod_target_xcconfig = {
|
|
43
|
+
:GCC_PREPROCESSOR_DEFINITIONS => "HAVE_FULLFSYNC=1",
|
|
44
|
+
:WARNING_CFLAGS => "-Wno-shorten-64-to-32 -Wno-comma -Wno-unreachable-code -Wno-conditional-uninitialized -Wno-deprecated-declarations",
|
|
45
|
+
:USE_HEADERMAP => "No",
|
|
46
|
+
:CLANG_CXX_LANGUAGE_STANDARD => "c++17",
|
|
47
|
+
:OTHER_CFLAGS => '$(inherited) -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_OMIT_DEPRECATED=1 -DSQLITE_OMIT_PROGRESS_CALLBACK=1 -DSQLITE_OMIT_SHARED_CACHE=1 -DSQLITE_USE_ALLOCA=1'
|
|
48
|
+
}
|
|
49
|
+
end
|
|
40
50
|
|
|
41
51
|
end
|