Skip to content

Commit

Permalink
src: replace icu with simdutf for char counts
Browse files Browse the repository at this point in the history
PR-URL: #46472
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
  • Loading branch information
anonrig authored and danielleadams committed Apr 3, 2023
1 parent 2b702c9 commit aaf04f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/inspector/node_string.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "node_string.h"
#include "node/inspector/protocol/Protocol.h"
#include "simdutf.h"

#include <unicode/unistr.h>

Expand Down Expand Up @@ -118,9 +119,8 @@ const uint8_t* CharactersUTF8(const String& s) {
}

size_t CharacterCount(const String& s) {
icu::UnicodeString utf16 =
icu::UnicodeString::fromUTF8(icu::StringPiece(s.data(), s.length()));
return utf16.countChar32();
// TODO(@anonrig): Test to make sure CharacterCount returns correctly.
return simdutf::utf32_length_from_utf8(s.data(), s.length());
}

} // namespace StringUtil
Expand Down

0 comments on commit aaf04f4

Please sign in to comment.