Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Issue 1541393003: Improve performance of Character::isCJKIdeographOrSymbol by using trie tree (Closed)

Created:
4 years, 12 months ago by kojii
Modified:
4 years, 10 months ago
Reviewers:
drott, eae, Dirk Pranke
CC:
chromium-reviews, krit, pdr+graphicswatchlist_chromium.org, drott+blinkwatch_chromium.org, blink-reviews-platform-graphics_chromium.org, dshwang, jbroman, Justin Novosad, danakj, Rik, f(malita), blink-reviews, vmpstr+blinkwatch_chromium.org, kinuko+watch, Stephen Chennney, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Improve performance of Character::isCJKIdeographOrSymbol by using trie tree This patch is another effort to make Character::isCJKIdeographOrSymbol faster. The previous CL[1] made it faster by ~90% for codepoints below U+2020, but codepoints abvoe U+2020 were not as fast. This CL makes all codepoints faster, as fast as ICU functions. Before After Improve ICU All 2569 => 292 88% 298 ASCII 68 => 68 0% 160 Han 2958 => 263 91% 344 Hira 258 => 11 95% 14 Arabic 37 => 32 13% 44 * # of code points and iterations vary by rows. The previous CL[1] clarified that binary search is not as fast as ICU functions such as uscript_getScript(). This patch changes to use UTrie2, which is the data structure ICU property functions use. In addition in this patch: * U+2763 and U+2764 are added as requested by drott@. * Character::isUprightInMixedVertical() was switched to UTrie2 too. * Character::isCJKIdeograph() was removed because it is no longer used. [1] https://codereview.chromium.org/1545073002 BUG=571943 Committed: https://crrev.com/e6dc3f425137021f39eddbbeb2035273ce36f986 Cr-Commit-Position: refs/heads/master@{#371917}

Patch Set 1 #

Patch Set 2 : UTrie2 for isCJKIdeographOrSymbol #

Patch Set 3 : isCJKIdeograph and isUprightInMixedVertical #

Patch Set 4 : Fix minor errors #

Patch Set 5 : Fix Linux/Mac compile error #

Patch Set 6 : Cleanup, remove isCJKIdeograph, remove perf test code #

Total comments: 12

Patch Set 7 : drott review #

Patch Set 8 : Construct the UTrie2 from the serialized byte array #

Patch Set 9 : Android compiler doesn't like trailing backslash in comments #

Patch Set 10 : Rebase #

Patch Set 11 : Rebase #

Patch Set 12 : gn support, gyp NYI #

Patch Set 13 : gyp #

Patch Set 14 : cross-compile try #

Patch Set 15 : gn cross-compiler trial cont'd #

Patch Set 16 : gyp cross-compile still fails, another try #

Patch Set 17 : gyp+cross-compile, another try #

Patch Set 18 : gyp cross-compile still fails, another try #

Patch Set 19 : Add #host to icuuc #

Patch Set 20 : Revert to PS11 #

Patch Set 21 : Revert to PS19, add support for use_system_icu #

Patch Set 22 : Use pre-generated file if (gyp and (android or chromeos)) #

Patch Set 23 : Changed the criteria to target_arch!=host_arch #

Patch Set 24 : Tweak conditions #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1146 lines, -253 lines) Patch
M third_party/WebKit/Source/platform/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 20 3 chunks +38 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/blink_platform.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 17 20 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/Character.h View 1 2 3 4 5 6 7 8 9 10 11 20 3 chunks +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/fonts/Character.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 20 3 chunks +29 lines, -240 lines 0 comments Download
A third_party/WebKit/Source/platform/fonts/CharacterData.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +634 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/platform/fonts/CharacterDataGenerator.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 20 1 chunk +337 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/platform/fonts/CharacterProperty.h View 1 2 3 4 5 6 7 8 9 10 11 20 1 chunk +39 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/CharacterTest.cpp View 1 2 3 4 5 6 7 8 9 10 2 chunks +12 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/platform/platform_generated.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 chunks +53 lines, -0 lines 0 comments Download

Messages

Total messages: 53 (18 generated)
kojii
PTAL.
4 years, 11 months ago (2016-01-13 17:55:34 UTC) #13
drott
I think it's a great direction for improvement of this code. Thanks, Koji! Maybe I ...
4 years, 11 months ago (2016-01-14 12:10:54 UTC) #14
kojii
PTAL. Most fixed, and comments inlne. > I think it's a great direction for improvement ...
4 years, 11 months ago (2016-01-14 15:34:33 UTC) #15
drott
> > Maybe I missed some earlier discussion but could you explain the values/unit > ...
4 years, 11 months ago (2016-01-14 17:12:12 UTC) #16
kojii
On 2016/01/14 17:12:12, drott wrote: > > P(All, 0x0000, 0x1FFFFF, 10) > > P(ASCII, 0x0020, ...
4 years, 11 months ago (2016-01-15 02:20:04 UTC) #17
kojii
PTAL. Back from on-hold with a new (a bit wild) idea that popped in my ...
4 years, 11 months ago (2016-01-15 08:00:41 UTC) #20
kojii
Oh BTW, this will conflict with your CL I just replied. Please land first and ...
4 years, 11 months ago (2016-01-15 08:02:37 UTC) #21
kojii
One more thing: the ICU compile failure on Windows was reported to: http://bugs.icu-project.org/trac/ticket/12075
4 years, 11 months ago (2016-01-15 08:05:36 UTC) #22
drott
On 2016/01/15 08:00:41, kojii wrote: > PTAL. Back from on-hold with a new (a bit ...
4 years, 11 months ago (2016-01-15 10:00:38 UTC) #24
kojii
On 2016/01/15 10:00:38, drott wrote: > On 2016/01/15 08:00:41, kojii wrote: > > PTAL. Back ...
4 years, 11 months ago (2016-01-15 10:54:31 UTC) #25
drott
> Great thank you. > > ...can we make it a separate work? I'd like ...
4 years, 11 months ago (2016-01-18 09:35:30 UTC) #26
kojii
Thank you for finding examples, I can have a look, but I don't know why ...
4 years, 11 months ago (2016-01-18 10:49:26 UTC) #27
drott
On 2016/01/18 10:49:26, kojii wrote: > Thank you for finding examples, I can have a ...
4 years, 11 months ago (2016-01-18 12:35:10 UTC) #28
kojii
I didn't mean ranges will not change, I agree it will. I meant when dev ...
4 years, 11 months ago (2016-01-18 15:19:59 UTC) #29
kojii
Asked around a few experts on generators, here's short summary: 1. There are both cases ...
4 years, 11 months ago (2016-01-22 05:49:09 UTC) #30
kojii
6. Another option is to build the generator and upload the binary.
4 years, 11 months ago (2016-01-22 05:52:48 UTC) #31
kojii
dpranke@, could you mind to review gyp-cross-compile part? Among the combinations of: 1. gn, self-compile ...
4 years, 11 months ago (2016-01-26 08:58:34 UTC) #32
Dirk Pranke
The code (including the GYP changes) looks correct to me, so I'm not sure why ...
4 years, 11 months ago (2016-01-26 23:05:07 UTC) #33
kojii
On 2016/01/26 23:05:07, Dirk Pranke wrote: > The code (including the GYP changes) looks correct ...
4 years, 11 months ago (2016-01-27 00:30:15 UTC) #34
kojii
eae@, PTAL while drott@ is off?
4 years, 11 months ago (2016-01-27 02:21:17 UTC) #35
eae
Looks good but I'd still like to see the generator hooked up to a build ...
4 years, 11 months ago (2016-01-27 02:25:18 UTC) #36
kojii
On 2016/01/27 02:25:18, eae wrote: > Looks good but I'd still like to see the ...
4 years, 11 months ago (2016-01-27 03:09:15 UTC) #37
eae
No worries, I should have been more explicit about that. Thank you.
4 years, 11 months ago (2016-01-27 03:44:04 UTC) #38
kojii
PTAL. GYP is manual if Android || CrOS || cross-compile. GN is always automatic.
4 years, 11 months ago (2016-01-27 22:18:30 UTC) #39
eae
LGTM Thank you!
4 years, 11 months ago (2016-01-27 22:24:02 UTC) #40
kojii
Thank you for your advice!
4 years, 11 months ago (2016-01-27 23:04:02 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1541393003/460001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1541393003/460001
4 years, 11 months ago (2016-01-27 23:05:59 UTC) #43
commit-bot: I haz the power
Committed patchset #24 (id:460001)
4 years, 11 months ago (2016-01-28 00:15:04 UTC) #45
commit-bot: I haz the power
Patchset 24 (id:??) landed as https://crrev.com/e6dc3f425137021f39eddbbeb2035273ce36f986 Cr-Commit-Position: refs/heads/master@{#371917}
4 years, 11 months ago (2016-01-28 00:16:28 UTC) #47
Anand Mistry (off Chromium)
On 2016/01/28 00:16:28, commit-bot: I haz the power wrote: > Patchset 24 (id:??) landed as ...
4 years, 10 months ago (2016-01-28 03:13:13 UTC) #48
kojii
On 2016/01/28 03:13:13, Anand Mistry wrote: > On 2016/01/28 00:16:28, commit-bot: I haz the power ...
4 years, 10 months ago (2016-01-28 03:17:15 UTC) #49
kojii
On 2016/01/28 03:17:15, kojii wrote: > On 2016/01/28 03:13:13, Anand Mistry wrote: > > On ...
4 years, 10 months ago (2016-01-28 03:25:19 UTC) #50
kojii
A revert of this CL (patchset #24 id:460001) has been created in https://codereview.chromium.org/1644893002/ by kojii@chromium.org. ...
4 years, 10 months ago (2016-01-28 04:05:42 UTC) #51
sL1pKn07
Also fail build if use -Duse_system_icu=1 and newer version of ICU (for example ICU 56)
4 years, 10 months ago (2016-01-30 09:49:24 UTC) #52
sL1pKn07
4 years, 10 months ago (2016-01-30 09:51:10 UTC) #53
Message was sent while issue was closed.
On 2016/01/30 09:49:24, sL1pKn07 wrote:
> Also fail build if use -Duse_system_icu=1 and newer version of ICU (for
example
> ICU 56)

[1531/19105]
/tmp/makepkg/chromium-dev/src/chromium-50.0.2633.3/third_party/llvm-build/Release+Asserts/bin/clang++
-Qunused-arguments -MMD -MF
obj/third_party/sfntly/src/cpp/src/sfntly/table/bitmap/sfntly.index_sub_table_format2.o.d
-DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -D_FILE_OFFSET_BITS=64
-DCHROMIUM_BUILD -DCR_CLANG_REVISION=257955-1 -DUI_COMPOSITOR_IMAGE_TRANSPORT
-DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_DEFAULT_RENDER_THEME=1
-DUSE_LIBJPEG_TURBO=1 -DUSE_X11=1 -DUSE_CLIPBOARD_AURAX11=1
-DENABLE_ONE_CLICK_SIGNIN -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1
-DUSE_PROPRIETARY_CODECS -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY
-DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DENABLE_TOPCHROME_MD=1 -DUSE_UDEV
-DDONT_EMBED_BUILD_METADATA -DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1
-DENABLE_EXTENSIONS=1 -DENABLE_PDF=1 -DENABLE_PLUGINS=1
-DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1
-DENABLE_BACKGROUND=1 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1
-DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1
-DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1
-DENABLE_SUPERVISED_USERS=1 -DENABLE_MDNS=1 -DENABLE_SERVICE_DISCOVERY=1
-DENABLE_HANGOUT_SERVICES_EXTENSION=1 -DV8_USE_EXTERNAL_STARTUP_DATA
-DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL
-DSFNTLY_NO_EXCEPTION -DU_USING_ICU_NAMESPACE=0 -DUSE_LIBPCI=1 -DUSE_OPENSSL=1
-DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0
-Igen/shim_headers/icuuc/target -Igen -I../../third_party/sfntly/src/cpp/src
-fstack-protector --param=ssp-buffer-size=4  -pthread -fno-strict-aliasing -Wall
-Wextra -Wno-unused-parameter -Wno-missing-field-initializers
-fvisibility=hidden -pipe -fPIC -Xclang -load -Xclang
/tmp/makepkg/chromium-dev/src/chromium-50.0.2633.3/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so
-Xclang -add-plugin -Xclang find-bad-constructs -Xclang
-plugin-arg-find-bad-constructs -Xclang check-templates -fcolor-diagnostics
-Wheader-hygiene -Wfor-loop-analysis -Wno-char-subscripts
-Wno-unneeded-internal-declaration -Wno-covered-switch-default
-Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register
-Wno-inconsistent-missing-override -Wno-shift-negative-value -m64 -march=x86-64
-O2 -fno-ident -fdata-sections -ffunction-sections -funwind-tables -march=native
-O2 -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fno-exceptions -fno-rtti
-fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11  -c
../../third_party/sfntly/src/cpp/src/sfntly/table/bitmap/index_sub_table_format2.cc
-o
obj/third_party/sfntly/src/cpp/src/sfntly/table/bitmap/sfntly.index_sub_table_format2.o
FAILED:
/tmp/makepkg/chromium-dev/src/chromium-50.0.2633.3/third_party/llvm-build/Release+Asserts/bin/clang++
-Qunused-arguments -MMD -MF
obj/third_party/WebKit/Source/platform/fonts/character_data_generator.CharacterDataGenerator.o.d
-DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -D_FILE_OFFSET_BITS=64
-DCHROMIUM_BUILD -DCR_CLANG_REVISION=257955-1 -DUI_COMPOSITOR_IMAGE_TRANSPORT
-DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_DEFAULT_RENDER_THEME=1
-DUSE_LIBJPEG_TURBO=1 -DUSE_X11=1 -DUSE_CLIPBOARD_AURAX11=1
-DENABLE_ONE_CLICK_SIGNIN -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1
-DUSE_PROPRIETARY_CODECS -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY
-DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DENABLE_TOPCHROME_MD=1 -DUSE_UDEV
-DDONT_EMBED_BUILD_METADATA -DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1
-DENABLE_EXTENSIONS=1 -DENABLE_PDF=1 -DENABLE_PLUGINS=1
-DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1
-DENABLE_BACKGROUND=1 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1
-DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1
-DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1
-DENABLE_SUPERVISED_USERS=1 -DENABLE_MDNS=1 -DENABLE_SERVICE_DISCOVERY=1
-DENABLE_HANGOUT_SERVICES_EXTENSION=1 -DV8_USE_EXTERNAL_STARTUP_DATA
-DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL
-DU_USING_ICU_NAMESPACE=0 -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DUSE_GLIB=1
-DUSE_NSS_CERTS=1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0
-Igen/shim_headers/icuuc/target -Igen -fstack-protector
--param=ssp-buffer-size=4  -pthread -fno-strict-aliasing -Wall
-Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe
-fPIC -Xclang -load -Xclang
/tmp/makepkg/chromium-dev/src/chromium-50.0.2633.3/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so
-Xclang -add-plugin -Xclang find-bad-constructs -Xclang
-plugin-arg-find-bad-constructs -Xclang check-templates -fcolor-diagnostics
-Wheader-hygiene -Wfor-loop-analysis -Wno-char-subscripts
-Wno-unneeded-internal-declaration -Wno-covered-switch-default
-Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register
-Wno-inconsistent-missing-override -Wno-shift-negative-value
-Wno-unused-variable -m64 -march=x86-64 -O2 -fno-ident -fdata-sections
-ffunction-sections -funwind-tables -march=native -O2 -pipe
-fstack-protector-strong -D_FORTIFY_SOURCE=2 -fno-exceptions -fno-rtti
-fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -Wno-deprecated
 -c ../../third_party/WebKit/Source/platform/fonts/CharacterDataGenerator.cpp -o
obj/third_party/WebKit/Source/platform/fonts/character_data_generator.CharacterDataGenerator.o
../../third_party/WebKit/Source/platform/fonts/CharacterDataGenerator.cpp:12:10:
fatal error: 'utrie2.h' file not found

Powered by Google App Engine
This is Rietveld 408576698