dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.08k stars 4.7k forks source link

[browser][HybridGlobalization][tracking] Regressions of text APIs when running in *HybridGlobalization* mode. #94473

Open matouskozak opened 11 months ago

matouskozak commented 11 months ago

Based on our investigations, some of the String, TextInfo and CompareInfo APIs are running slower with WASM HybridGlobalization (HG) enabled than with HG disabled.

Here is the summary of the largest regressions. We compare the default behavior (using ICU4C) to the scenario with enabled HG (both running with interpreter, similar numbers are reported for AOT as well).

API time ICU4C [ms] time HG [ms] slow-down
String, TextInfo ToLower 0.2698 90.9531 33611%
String, TextInfo ToUpper 0.2545 90.9077 35620%
String, TextInfo ToTitleCase 7.1761 113.7647 1485%
String, String Compare 0.0397 0.374 842%
String, String Equals 0.0397 0.3717 836%
String, CompareInfo Compare 0.0393 0.373 849%
String, String IndexOf 4.7239 2362.6667 49915%
String, String LastIndexOf 8.1408 2361 28902%

Note: These regressions only influence application where HG is enabled (e.g., by adding <HybridGlobalization>true</HybridGlobalization> to the .csproj file) as it is not the default settings.


Tracking list of APIs waiting to be optimize:


cc: @ilonatommy @mkhamoyan @SamMonoRT

ghost commented 11 months ago

Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.

Issue Details
Based on our investigations, some of the String, TextInfo and CompareInfo APIs are running slower with WASM *HybridGlobalization (HG)* enabled than with HG disabled. Here is the summary of the largest regressions. We compare the default behavior (using ICU4C) to scenario with enabled *HG* (both running with interpreter). | API | time ICU4C [ms] | time HG [ms] | slow-down | |-----------------------------|-----------------|--------------|-----------| | String, TextInfo ToLower | 0.2698 | 90.9531 | 33611% | | String, TextInfo ToUpper | 0.2545 | 90.9077 | 35620% | | String, TextInfo ToTitleCase | 7.1761 | 113.7647 | 1485% | | String, String Compare | 0.0397 | 0.374 | 842% | | String, String Equals | 0.0397 | 0.3717 | 836% | | String, CompareInfo Compare | 0.0393 | 0.373 | 849% | | String, String IndexOf | 4.7239 | 2362.6667 | 49915% | | String, String LastIndexOf | 8.1408 | 2361 | 28902% | Similar numbers are reported for AOT as well. Note: These regressions only influence application where *HG* is enabled (e.g., by adding `true` to the `.csproj` file) as it is not the default settings. --- Tracking list of APIs waiting to be optimize: - [ ] ToLower - [ ] ToUpper - [ ] ToTitleCase - [ ] Compare - [ ] Equals - [ ] IndexOf - [ ] LastIndexOf --- cc: @ilonatommy @mkhamoyan @SamMonoRT
Author: matouskozak
Assignees: -
Labels: `arch-wasm`, `area-System.Globalization`
Milestone: -
matouskozak commented 2 months ago

Moving to .net 10 as it is not blocking a release. Hybrid globalization on browser is an optional feature. cc: @ilonatommy