Skip to content

Commit c3352a8

Browse files
authored
Add benchmarks to example app (#56)
* add benchmark tests * add copyright notice * update copyright comment * updates * fix: benchmarks (non nitro)
1 parent 91437ff commit c3352a8

File tree

21 files changed

+1426
-1028
lines changed

21 files changed

+1426
-1028
lines changed

example/ios/Podfile.lock

Lines changed: 35 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,71 +1259,7 @@ PODS:
12591259
- ReactCommon/turbomodule/core
12601260
- Yoga
12611261
- react-native-safe-area-context (4.11.0):
1262-
- DoubleConversion
1263-
- glog
1264-
- hermes-engine
1265-
- RCT-Folly (= 2024.01.01.00)
1266-
- RCTRequired
1267-
- RCTTypeSafety
1268-
- React-Core
1269-
- React-debug
1270-
- React-Fabric
1271-
- React-featureflags
1272-
- React-graphics
1273-
- React-ImageManager
1274-
- react-native-safe-area-context/common (= 4.11.0)
1275-
- react-native-safe-area-context/fabric (= 4.11.0)
1276-
- React-NativeModulesApple
1277-
- React-RCTFabric
1278-
- React-rendererdebug
1279-
- React-utils
1280-
- ReactCodegen
1281-
- ReactCommon/turbomodule/bridging
1282-
- ReactCommon/turbomodule/core
1283-
- Yoga
1284-
- react-native-safe-area-context/common (4.11.0):
1285-
- DoubleConversion
1286-
- glog
1287-
- hermes-engine
1288-
- RCT-Folly (= 2024.01.01.00)
1289-
- RCTRequired
1290-
- RCTTypeSafety
1291-
- React-Core
1292-
- React-debug
1293-
- React-Fabric
1294-
- React-featureflags
1295-
- React-graphics
1296-
- React-ImageManager
1297-
- React-NativeModulesApple
1298-
- React-RCTFabric
1299-
- React-rendererdebug
1300-
- React-utils
1301-
- ReactCodegen
1302-
- ReactCommon/turbomodule/bridging
1303-
- ReactCommon/turbomodule/core
1304-
- Yoga
1305-
- react-native-safe-area-context/fabric (4.11.0):
1306-
- DoubleConversion
1307-
- glog
1308-
- hermes-engine
1309-
- RCT-Folly (= 2024.01.01.00)
1310-
- RCTRequired
1311-
- RCTTypeSafety
13121262
- React-Core
1313-
- React-debug
1314-
- React-Fabric
1315-
- React-featureflags
1316-
- React-graphics
1317-
- React-ImageManager
1318-
- react-native-safe-area-context/common
1319-
- React-NativeModulesApple
1320-
- React-RCTFabric
1321-
- React-rendererdebug
1322-
- React-utils
1323-
- ReactCodegen
1324-
- ReactCommon/turbomodule/bridging
1325-
- ReactCommon/turbomodule/core
1326-
- Yoga
13271263
- React-nativeconfig (0.75.2)
13281264
- React-NativeModulesApple (0.75.2):
13291265
- glog
@@ -1584,6 +1520,28 @@ PODS:
15841520
- React-logger (= 0.75.2)
15851521
- React-perflogger (= 0.75.2)
15861522
- React-utils (= 0.75.2)
1523+
- RNScreens (3.34.0):
1524+
- DoubleConversion
1525+
- glog
1526+
- hermes-engine
1527+
- RCT-Folly (= 2024.01.01.00)
1528+
- RCTRequired
1529+
- RCTTypeSafety
1530+
- React-Core
1531+
- React-debug
1532+
- React-Fabric
1533+
- React-featureflags
1534+
- React-graphics
1535+
- React-ImageManager
1536+
- React-NativeModulesApple
1537+
- React-RCTFabric
1538+
- React-RCTImage
1539+
- React-rendererdebug
1540+
- React-utils
1541+
- ReactCodegen
1542+
- ReactCommon/turbomodule/bridging
1543+
- ReactCommon/turbomodule/core
1544+
- Yoga
15871545
- SocketRocket (0.7.0)
15881546
- Yoga (0.0.0)
15891547

@@ -1653,6 +1611,7 @@ DEPENDENCIES:
16531611
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
16541612
- ReactCodegen (from `build/generated/ios`)
16551613
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
1614+
- RNScreens (from `../node_modules/react-native-screens`)
16561615
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
16571616

16581617
SPEC REPOS:
@@ -1787,6 +1746,8 @@ EXTERNAL SOURCES:
17871746
:path: build/generated/ios
17881747
ReactCommon:
17891748
:path: "../node_modules/react-native/ReactCommon"
1749+
RNScreens:
1750+
:path: "../node_modules/react-native-screens"
17901751
Yoga:
17911752
:path: "../node_modules/react-native/ReactCommon/yoga"
17921753

@@ -1807,16 +1768,16 @@ SPEC CHECKSUMS:
18071768
React-CoreModules: f92a2cb11d22f6066823ca547c61e900325dfe44
18081769
React-cxxreact: f5595a4cbfe5a4e9d401dffa2c1c78bbbbbe75e4
18091770
React-debug: 4a91c177b5b2efcc546fb50bc2f676f3f589efab
1810-
React-defaultsnativemodule: 6b666572abf5fe7fe87836a42776abd6ad5ed173
1811-
React-domnativemodule: 785d767c4edbb9f011b8c976271077759ca5c4aa
1771+
React-defaultsnativemodule: bb94c3db425b01c760f41a253de8536b3f5497f0
1772+
React-domnativemodule: 6c581fd39812cafb024171e091c00905b2c3a3e2
18121773
React-Fabric: a33cc1fdc62a3085774783bb30970531589d2028
18131774
React-FabricComponents: 98de5f94cbd35d407f4fc78855298b562d8289cb
18141775
React-FabricImage: 0ce8fd83844d9edef5825116d38f0e208b9ad786
18151776
React-featureflags: 37a78859ad71db758e2efdcbdb7384afefa8701e
1816-
React-featureflagsnativemodule: f94aacb52c463e200ee185bff90ae3b392e60263
1777+
React-featureflagsnativemodule: 52b46e161a151b4653cf1762285e8e899d534e3f
18171778
React-graphics: c16f1bab97a5d473831a79360d84300e93a614e5
18181779
React-hermes: 7801f8c0e12f326524b461dc368d3e74f3d2a385
1819-
React-idlecallbacksnativemodule: d81bb7b5d26cea9852a8edc6ad1979cd7ed0841f
1780+
React-idlecallbacksnativemodule: 58de2ac968ee80947d19dc8fe20def607e5c2de8
18201781
React-ImageManager: 98a1e5b0b05528dde47ebcd953d916ac66d46c09
18211782
React-jserrorhandler: 08f1c3465a71a6549c27ad82809ce145ad52d4f1
18221783
React-jsi: 161428ab2c706d5fcd9878d260ff1513fdb356ab
@@ -1825,18 +1786,18 @@ SPEC CHECKSUMS:
18251786
React-jsitracing: 52b849a77d02e2dc262a3031454c23be8dabb4d9
18261787
React-logger: 8db32983d75dc2ad54f278f344ccb9b256e694fc
18271788
React-Mapbuffer: 1c08607305558666fd16678b85ef135e455d5c96
1828-
React-microtasksnativemodule: f13f03163b6a5ec66665dfe80a0df4468bb766a6
1829-
react-native-quick-sqlite: 7c793c9f5834e756b336257a8d8b8239b7ceb451
1830-
react-native-safe-area-context: f1fda705dfe14355f41933debb5932887e234cc5
1789+
React-microtasksnativemodule: 87b8de96f937faefece8afd2cb3a518321b2ef99
1790+
react-native-quick-sqlite: c323337815c4598ea870e12f8c94db69110e24b4
1791+
react-native-safe-area-context: 851c62c48dce80ccaa5637b6aa5991a1bc36eca9
18311792
React-nativeconfig: 57781b79e11d5af7573e6f77cbf1143b71802a6d
18321793
React-NativeModulesApple: 7ff2e2cfb2e5fa5bdedcecf28ce37e696c6ef1e1
18331794
React-perflogger: 8a360ccf603de6ddbe9ff8f54383146d26e6c936
18341795
React-performancetimeline: 3cfec915adcb3653a5a633b41e711903844c35d8
18351796
React-RCTActionSheet: 1c0e26a88eec41215089cf4436e38188cfe9f01a
18361797
React-RCTAnimation: d87207841b1e2ae1389e684262ea8c73c887cb04
1837-
React-RCTAppDelegate: 328e56399c4f1c3d20cfe547ea24ebded2b3a87f
1798+
React-RCTAppDelegate: 4ec7824c0cc9cc4b146ca8ee0fd81b10c316a440
18381799
React-RCTBlob: 79b42cb7db55f34079297687a480dbcf37f023f6
1839-
React-RCTFabric: 27636a6a5fa5622159297fce26881945d3658cf6
1800+
React-RCTFabric: 1dd1661db93716f8cb116e451bd9c211a8d15716
18401801
React-RCTImage: 0c10a75de59f7384a2a55545d5f36fe783e6ecda
18411802
React-RCTLinking: bf08f4f655bf777af292b8d97449072c8bb196ca
18421803
React-RCTNetwork: 1b690846b40fc5685af58e088720657db6814637
@@ -1854,6 +1815,7 @@ SPEC CHECKSUMS:
18541815
React-utils: 81a715d9c0a2a49047e77a86f3a2247408540deb
18551816
ReactCodegen: 60973d382704c793c605b9be0fc7f31cb279442f
18561817
ReactCommon: 6ef348087d250257c44c0204461c03f036650e9b
1818+
RNScreens: 19719a9c326e925498ac3b2d35c4e50fe87afc06
18571819
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
18581820
Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8
18591821

example/ios/QuickSQLiteExample.xcodeproj/project.pbxproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,10 @@
606606
"-DFOLLY_CFG_NO_COROUTINES=1",
607607
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
608608
);
609-
OTHER_LDFLAGS = "$(inherited) ";
609+
OTHER_LDFLAGS = (
610+
"$(inherited)",
611+
" ",
612+
);
610613
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
611614
SDKROOT = iphoneos;
612615
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
@@ -679,7 +682,10 @@
679682
"-DFOLLY_CFG_NO_COROUTINES=1",
680683
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
681684
);
682-
OTHER_LDFLAGS = "$(inherited) ";
685+
OTHER_LDFLAGS = (
686+
"$(inherited)",
687+
" ",
688+
);
683689
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
684690
SDKROOT = iphoneos;
685691
USE_HERMES = true;

example/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,27 @@
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {
6-
"pods": "cd ios && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install",
6+
"pods": "cd ios && bundle exec pod install",
77
"android": "react-native run-android",
88
"ios": "react-native run-ios",
99
"start": "react-native start",
1010
"postinstall": "patch-package"
1111
},
1212
"dependencies": {
1313
"@craftzdog/react-native-buffer": "^6.0.5",
14+
"@react-navigation/native": "^6.1.18",
15+
"@react-navigation/native-stack": "^6.11.0",
1416
"chai": "^4.3.7",
1517
"chance": "^1.1.9",
1618
"events": "^3.3.0",
19+
"mocha": "^10.1.0",
20+
"expo-status-bar": "^1.12.1",
1721
"nativewind": "^2.0.11",
1822
"react": "18.2.0",
1923
"react-native": "0.75.2",
2024
"react-native-quick-sqlite": "./..",
2125
"react-native-safe-area-context": "^4.11.0",
26+
"react-native-screens": "^3.34.0",
2227
"reflect-metadata": "^0.1.13",
2328
"stream-browserify": "^3.0.0",
2429
"tailwindcss": "^3.2.4",

example/src/App.tsx

Lines changed: 20 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,25 @@
1-
import React, {useEffect, useState} from 'react';
2-
import {SafeAreaView, ScrollView, Text} from 'react-native';
3-
import 'reflect-metadata';
4-
import {registerBaseTests, runTests} from './tests/index';
5-
// import {registerTypeORMTests} from './tests/typeorm.spec';
1+
import React from 'react'
2+
import 'reflect-metadata'
3+
import { UnitTestScreen } from './screens/UnitTestScreen'
4+
import { BenchmarkScreen } from './screens/BenchmarkScreen'
5+
import { createNativeStackNavigator } from '@react-navigation/native-stack'
6+
import { NavigationContainer } from '@react-navigation/native'
7+
import { StatusBar } from 'expo-status-bar'
8+
import { ParamList } from './navigation'
9+
import { HomeScreen } from './screens/HomeScreen'
610

7-
export default function App() {
8-
const [results, setResults] = useState<any>([]);
9-
10-
useEffect(() => {
11-
setResults([]);
12-
runTests(
13-
registerBaseTests,
14-
// registerTypeORMTests
15-
).then(setResults);
16-
}, []);
11+
const Stack = createNativeStackNavigator<ParamList>()
1712

13+
export default function App() {
1814
return (
19-
<SafeAreaView className="flex-1 bg-neutral-900">
20-
<ScrollView className="p-4">
21-
<Text className="font-bold text-blue-500 text-lg text-center">
22-
RN Quick SQLite Test Suite
23-
</Text>
24-
{results.map((r: any, i: number) => {
25-
if (r.type === 'grouping') {
26-
return (
27-
<Text key={i} className="mt-3 font-bold text-white">
28-
{r.description}
29-
</Text>
30-
);
31-
}
32-
33-
if (r.type === 'incorrect') {
34-
return (
35-
<Text key={i} className="mt-1 text-white">
36-
🔴 {r.description}: {r.errorMsg}
37-
</Text>
38-
);
39-
}
15+
<NavigationContainer>
16+
<Stack.Navigator initialRouteName="NitroSQLite Example">
17+
<Stack.Screen name="NitroSQLite Example" component={HomeScreen} />
18+
<Stack.Screen name="Unit Tests" component={UnitTestScreen} />
19+
<Stack.Screen name="Benchmarks" component={BenchmarkScreen} />
20+
</Stack.Navigator>
4021

41-
return (
42-
<Text key={i} className="mt-1 text-white">
43-
🟢 {r.description}
44-
</Text>
45-
);
46-
})}
47-
</ScrollView>
48-
</SafeAreaView>
49-
);
22+
<StatusBar style="auto" />
23+
</NavigationContainer>
24+
)
5025
}

example/src/Database.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { DataSource } from 'typeorm';
2-
import { typeORMDriver } from 'react-native-quick-sqlite';
3-
import { Book } from './model/Book';
4-
import { User } from './model/User';
1+
import { DataSource } from 'typeorm'
2+
import { typeORMDriver } from 'react-native-quick-sqlite'
3+
import { Book } from './model/Book'
4+
import { User } from './model/User'
55
// import { Buffer } from 'buffer';
6-
let datasource: DataSource;
6+
let datasource: DataSource
77

88
export async function typeORMInit() {
99
datasource = new DataSource({
@@ -13,11 +13,11 @@ export async function typeORMInit() {
1313
driver: typeORMDriver,
1414
entities: [Book, User],
1515
synchronize: true,
16-
});
16+
})
1717

18-
await datasource.initialize();
18+
await datasource.initialize()
1919

20-
const bookRepository = datasource.getRepository(Book);
20+
const bookRepository = datasource.getRepository(Book)
2121
// const userRepository = getRepository(User);
2222
// const user1 = new User();
2323
// user1.name = 'John Seedman 🤯';
@@ -31,11 +31,11 @@ export async function typeORMInit() {
3131
// '/9j/4AAQSkZJRgABAQEAYABgAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2NjIpLCBxdWFsaXR5ID0gOTAK/9sAQwADAgIDAgIDAwMDBAMDBAUIBQUEBAUKBwcGCAwKDAwLCgsLDQ4SEA0OEQ4LCxAWEBETFBUVFQwPFxgWFBgSFBUU/9sAQwEDBAQFBAUJBQUJFA0LDRQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB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r4uftK83J+YUUUV0nKf/Z',
3232
// 'base64'
3333
// ).buffer;
34-
const book1 = new Book();
35-
book1.id = Math.random().toString();
36-
book1.title = 'Lord of the rings';
34+
const book1 = new Book()
35+
book1.id = Math.random().toString()
36+
book1.title = 'Lord of the rings'
3737

38-
await bookRepository.save(book1);
38+
await bookRepository.save(book1)
3939
// await userRepository.save(user1);
4040
// const users = await userRepository.find();
4141
// // const users = await userRepository.find({
@@ -45,18 +45,18 @@ export async function typeORMInit() {
4545
}
4646

4747
export async function typeORMGetBooks() {
48-
const bookRepository = datasource.getRepository(Book);
49-
return await bookRepository.find();
48+
const bookRepository = datasource.getRepository(Book)
49+
return await bookRepository.find()
5050
}
5151

5252
export async function executeFailingTypeORMQuery() {
53-
const bookRepository = datasource.getRepository(Book);
53+
const bookRepository = datasource.getRepository(Book)
5454

5555
try {
5656
const manualQuery = await bookRepository.query(`
5757
SELECT * From UnexistingTable
58-
`);
58+
`)
5959
} catch (e) {
60-
console.warn('should have cached');
60+
console.warn('should have cached')
6161
}
6262
}

example/src/model/Book.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import 'reflect-metadata';
1+
import 'reflect-metadata'
22
import {
33
Entity,
44
Column,
55
PrimaryGeneratedColumn,
66
OneToOne,
77
JoinColumn,
8-
} from 'typeorm/browser';
9-
import { BaseEntity } from 'typeorm';
8+
} from 'typeorm/browser'
9+
import { BaseEntity } from 'typeorm'
1010

1111
@Entity()
1212
export class Book extends BaseEntity {
1313
@PrimaryGeneratedColumn('uuid')
14-
id!: string;
14+
id!: string
1515

1616
@Column()
17-
title!: string;
17+
title!: string
1818
}

0 commit comments

Comments
 (0)