Skip to content
This repository was archived by the owner on Sep 14, 2026. It is now read-only.
This repository was archived by the owner on Sep 14, 2026. It is now read-only.

Split string by a delimiter to array #4

Description

@astutesoftware

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

Activity

  1. magiclen commented on Jun 1, 2019

    @magiclen
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions