-
Notifications
You must be signed in to change notification settings - Fork 162
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
ファイル読み込みの高速化 #1951
ファイル読み込みの高速化 #1951
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -392,8 +392,7 @@ char32_t ConvertToUtf32(std::wstring_view text) { | |
* 文字列がIVSの異体字セレクタで始まっているか判定する | ||
*/ | ||
inline bool IsVariationSelector(std::wstring_view text) { | ||
const auto cp = ConvertToUtf32(text); | ||
return 0xe0100 <= cp && cp <= 0xe01ef; | ||
return (2 <= text.size()) && (text[0] == 0xDB40) && (0xDD00 <= text[1]) && (text[1] <= 0xDDEF); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. この変更は速度に影響ありますか? 「0xe0100~0xe01ef」が見えなくなることを気にしています。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. あります。ファイル読み込み処理全体 (DocFileOperation::FileLoad) の約10%はこの ConvertToUtf32 が消費していました。 |
||
} | ||
|
||
//! 上位バイトと下位バイトを交換 (主に UTF-16 LE/BE 向け) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,7 +225,7 @@ TEST(CTextMetrics, GenerateDxArray8) | |
// IVSのVariantSelectorが続く文字列は先頭1文字 + 幅0×2で生成する | ||
std::vector<int> v; | ||
FakeCache1 cache; | ||
CTextMetrics::GenerateDxArray(&v, L"葛󠄀", 2, 0, 0, 0, 10, cache); | ||
CTextMetrics::GenerateDxArray(&v, L"葛󠄀", 3, 0, 0, 0, 10, cache); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 長さ指定が間違っていそうなのでついでに修正します。(PR反映後のテスト実行で失敗したため判明) |
||
EXPECT_TRUE(v[0]); | ||
EXPECT_FALSE(v[1]); | ||
EXPECT_FALSE(v[2]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
今後、std::wstring_view 型で文字列を扱う処理からも使うことも考えて std::wstring_view 型を受け入れる版も引き続き利用できるようにします。