Skip to content

Commit dfee311

Browse files
committed
feat: add ios performance mode
1 parent e8389fb commit dfee311

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

package/RNQuickSQLite.podspec

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ require "json"
22

33
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
44

5+
# TODO: Should be customizable in package.json.
6+
# Used to create comparable benchmark results
7+
performance_mode = 1
8+
59
Pod::Spec.new do |s|
610
s.name = "RNQuickSQLite"
711
s.version = package["version"]
@@ -35,6 +39,18 @@ Pod::Spec.new do |s|
3539
s.dependency "React-Core"
3640
end
3741

42+
optimizedCflags = '$(inherited) -DSQLITE_DQS=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'
43+
44+
if performance_mode == '1' then
45+
log_message.call("Thread unsafe (1) performance mode enabled. Use only transactions! 🚀🚀")
46+
xcconfig[:OTHER_CFLAGS] = optimizedCflags + ' -DSQLITE_THREADSAFE=0 '
47+
end
48+
49+
if performance_mode == '2' then
50+
log_message.call("Thread safe (2) performance mode enabled 🚀")
51+
xcconfig[:OTHER_CFLAGS] = optimizedCflags + ' -DSQLITE_THREADSAFE=1 '
52+
end
53+
3854
if ENV['QUICK_SQLITE_USE_PHONE_VERSION'] == '1' then
3955
s.exclude_files = "cpp/sqlite3.c", "cpp/sqlite3.h"
4056
s.library = "sqlite3"

0 commit comments

Comments
 (0)