Skip to content

Avoid string copies in ext/intl after string conversion #18636

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nielsdos
Copy link
Member

Introduces intl_convert_utf8_to_utf16_zstr() to convert a UTF-8 string to a UTF-16 string zend_string* instance. This way we avoid a double copy later from a UChar* into a zend_string*.

Introduces intl_convert_utf8_to_utf16_zstr() to convert a UTF-8 string
to a UTF-16 string zend_string* instance. This way we avoid a double
copy later from a UChar* into a zend_string*.
@devnexen
Copy link
Member

is that for perf ? avoid copy vs having to calculate buffer before hand it seems.

@nielsdos
Copy link
Member Author

is that for perf ?

Yes

avoid copy vs having to calculate buffer before hand it seems.

No. The existing code already had to calculate the buffer size beforehand (the call sites passed NULL to the target pointer).

@devnexen
Copy link
Member

ah my bad I missed the first call :) ok nice handy helper you made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants