Efficiently Converting a jsi::Array to a C++ std::vector Without Explicit Loops #1478
Closed
shivamst11
started this conversation in
General
Replies: 1 comment 1 reply
-
Hi! A jsi::Array can contain any kind of elements, including objects managed by the GC, so it is generally not safe to copy them into a std::vector. It could work if the array contained only numbers, but that is a very specific case, so there isn't an optimized API for it. However, if you need only numbers, I think it would be much more efficient to use an ArrayBuffer and copy from the underlying data pointer directly. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I'm working on a project where I need to convert a jsi::Array into a C++ std::vector. The array could potentially be quite large, so I'm concerned about the performance implications of using explicit loops for this conversion.
I'm looking for a best practices to handle this situation. Any insights or code snippets would be greatly appreciated!
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions