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

Zig toolchain uses slow-path for string shuffling in a few places #234

Open
fwsGonzo opened this issue Dec 11, 2024 · 1 comment
Open

Zig toolchain uses slow-path for string shuffling in a few places #234

fwsGonzo opened this issue Dec 11, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@fwsGonzo
Copy link
Collaborator

The ABI of the libc++ std::string is complex and hasn't been implemented host-side, so the current guest ABI for std::string uses a simple fallback method. It's probably better to first get the size() and the use something like https://en.cppreference.com/w/cpp/string/basic_string/resize_and_overwrite to initialize it.

@fwsGonzo fwsGonzo added the enhancement New feature or request label Dec 11, 2024
@fwsGonzo
Copy link
Collaborator Author

I have considered just always allocating the long string variation of libc++ std::string, even when they are smaller.
Implementation details: https://joellaity.com/2020/01/31/string.html

The raw struct:

struct __long {
    size_type __cap_;
    size_type __size_;
    pointer __data_;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant