-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Describe the feature request
Migrate to JSI can help to improve performance issues with the current implementation of React Native bridge and base64 encode/decode.
For return type of tensor input and output, we can construct ArrayBuffers from existing memory buffers, but it may be only supported by newer React Native version (>= 0.71?). Another way is implement type like blob-jsi-helper does with memcpy but it may causes some memory issues.
I might try to send a PR later for iOS first.
For Android, since it's using C++, it may require some additional work to access onnxruntime directly. (Calling java class through JNI may become complicated)
Describe scenario use case
Transformers.js is trying to support React Native (huggingface/transformers.js#118 by @hans00), I found that the performance in base64 encode/decode of buffer is not so good. See also this comment.
I also try to use react-native-blob-jsi-helper to replace base64 by a patch for test purpose, see this draft PR for more details.