Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split string by a delimiter to array #4

Open
astutesoftware opened this issue Jun 1, 2019 · 1 comment
Open

Split string by a delimiter to array #4

astutesoftware opened this issue Jun 1, 2019 · 1 comment

Comments

@astutesoftware
Copy link

Splitting strings by a delimiter to an array is an expensive operation.
Any idea when we can expect this from stringbuilder?

@magiclen
Copy link
Owner

magiclen commented Jun 1, 2019

If it were in the Rust language, there is a type called string slice (&str) which can avoid copying each substring into other memory space. After splitting, it can just returns an array of string slices ([&str]), that should be pretty fast.

However, in Node.js, the use of napi_create_string_* functions causes cloning. I don't see any other functions in N-API that can create JS strings. Maybe it is not possible to prevent it.

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

No branches or pull requests

2 participants