You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by "pandalee99 (via GitHub)" <gi...@apache.org> on 2025/01/20 09:10:47 UTC
Re: [I] [C++] Use SIMD to retrofit and optimize furycpp [fury]
pandalee99 commented on issue #2013:
URL: https://github.com/apache/fury/issues/2013#issuecomment-2601831044
<img width="396" alt="Image" src="https://github.com/user-attachments/assets/c52acd36-e0ff-4c08-afe2-8507c1e21768" />
About [simdutf](https://github.com/simdutf/simdutf) then, I used `Single-header version` and did a simple test
``` c++
std::string utf16ToUtf8WithSIMDUTF(const std::u16string &utf16) {
// Get the length of the input UTF-16LE string
size_t utf16_length = utf16.length();
// Calculate the number of bytes required to convert UTF-16LE to UTF-8
size_t utf8_length = simdutf::utf8_length_from_utf16le(reinterpret_cast<const char16_t *>(utf16.data()), utf16_length);
// Create a string to store the UTF-8 result, initialized to the specified length
std::string utf8_result(utf8_length, '\0');
// Call convert_utf16le_to_utf8 to perform the conversion
size_t written_bytes = simdutf::convert_utf16le_to_utf8(reinterpret_cast<const char16_t *>(utf16.data()), utf16_length, utf8_result.data());
// Resize the string to match the actual number of written bytes
utf8_result.resize(written_bytes);
return utf8_result;
}
```
The operation efficiency is not as efficient
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org