Skip to content

Abstract promise code and make simple result creation faster#341

Merged
ospfranco merged 20 commits into
mainfrom
oscar/new
Nov 24, 2025
Merged

Abstract promise code and make simple result creation faster#341
ospfranco merged 20 commits into
mainfrom
oscar/new

Conversation

@ospfranco

@ospfranco ospfranco commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Improves the speed to execute (and executAsync) JS object creation by close to 50% by using clever caching of names and removing one loop in JS

The code that handles JS promises has also been abstracted away and it's now miles easier to work with than before. It's a worthy addition because it opens the doors for more async code in the future.

# Conflicts:
#	example/ios/OPSQLiteExample/AppDelegate.mm
#	example/ios/Podfile.lock
#	example/package.json
#	example/src/App.tsx
#	package.json
#	src/index.ts
#	yarn.lock

Working promisify

Working thread pool

Working off-thread work

Simplify data

Run on Android

Faster row creation

Single struct that captures all state to correctly invalidate a module

clean up

Global call invoker ref

Comments

Migrate other functions
@ospfranco ospfranco changed the title New architecture and JSI code Abstract promise code and make simple result creation faster Nov 21, 2025
@ospfranco ospfranco merged commit 7706606 into main Nov 24, 2025
20 of 24 checks passed
@ospfranco ospfranco deleted the oscar/new branch November 24, 2025 08:14
Comment thread package.json
Comment on lines +113 to +115
"dependencies": {
"react-native-safe-area-context": "^5.6.2"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ospfranco Is this a mistake? I guess this should be only in the example no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, probably

Comment thread src/index.ts
@@ -1,17 +1,6 @@
import { NativeModules } from 'react-native';

export {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ospfranco - this change is making TS unable to find the open fn etc with NodeNext module resolution. I think the same issue was originally fixed in #324. Are you open to reverting this change or was it causing issues elsewhere? Can patch on our side if not, no worries.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that said, I think maybe "customConditions": ["source"], in our tsconfig can fix this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I didn't do this on purpose, this is just vscode/eslint or something else that automatically applies this change. If you can fix it on your end it would be better. This is something that has no priority for me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, cheers for replying. Source didn't actually work when building but I think patching the d.ts file extensions into the imports in index.d.ts seems to do the trick. So more of an esm thing I guess (we're using op-sqlite inside a private npm package in a monorepo and all the packages are esm)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants