Skip to content

[browser][non-icu] HybridGlobalization compare - #84249

Merged
ilonatommy merged 10 commits into
dotnet:mainfrom
ilonatommy:hg-compare
Apr 7, 2023
Merged

[browser][non-icu] HybridGlobalization compare#84249
ilonatommy merged 10 commits into
dotnet:mainfrom
ilonatommy:hg-compare

Conversation

@ilonatommy

@ilonatommyilonatommy commented Apr 3, 2023

Copy link
Copy Markdown
Member

Implements a chunk of web-api based globalization. Is a part of HybridGlobalization feature and contributes to #79989.

Old, icu-based private API: GlobalizationNative_CompareString

New, non-icu private API: CompareString.

Affected public API (see: tests in CompareInfoTests.Compare.cs):

  • CompareInfo.Compare,
  • String.Compare,
  • String.Equals.

All changes in behavior are listed in docs\design\features\hybrid-globalization.md

Test nametime ICU4C [ms]time HG [ms]increase by [times]
String, String Compare0.04485.029112
String, String Equals0.04504.9587110
String, CompareInfo Compare0.04514.9238109

see final performance here: #85098
cc @SamMonoRT

Performance:
most of the processing time is taken by mono_wasm_compare_string (~60-70%) while ~50% is used for TextDecoder.decode and only up to 20% for localeCompare.

@ilonatommyilonatommy self-assigned this Apr 3, 2023
@ghost

ghost commented Apr 3, 2023

Copy link
Copy Markdown

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

Issue Details

Implements a chunk of web-api based globalization. Is a part of HybridGlobalization feature and contributes to #79989.

Requires #84019 to be merged first (it has changes introducing HybridGlobalization mode).

Old, icu-based private API: GlobalizationNative_CompareString

New, non-icu private API: CompareStringJS.

Affected public API (see: tests in CompareInfoTests.Compare.cs):

  • CompareInfo.Compare,
  • String.Compare.

All changes in behavior are listed in docs\design\features\hybrid-globalization.md

cc @SamMonoRT

Author:ilonatommy
Assignees:ilonatommy
Labels:

arch-wasm, area-System.Globalization

Milestone:-

@ilonatommyilonatommy changed the title [browser][non-icu] HybridGlobalization compare[browser][non-icu] HybridGlobalization compareApr 4, 2023
@ilonatommy
ilonatommy marked this pull request as ready for review April 5, 2023 09:13
@ilonatommy

Copy link
Copy Markdown
MemberAuthor

Failures: Blazor WasmBuildTests and AOT timeouts are not connected.

@ilonatommy
ilonatommy requested a review from tarekghApril 5, 2023 09:14
hiraganaBig.localeCompare(katakanaSmall, "en-US", { sensitivity: "base" }) // 0; base: a ≠ b, a = á, a = A
```

- List of all `CompareOptions` combinations always throwing `PlatformNotSupportedException`:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, could we use attributes or a compile time analyzer to make builds fail when the user's code attempts to use these combinations? (Obviously not in this PR)

@ilonatommyilonatommyApr 5, 2023

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could but I am not sure if I know how to do it. Do we have a similar mechanism somewhere already?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, maybe ask in the group chat or channel. I haven't touched any of our generators/analyzers but I know we have a couple like the JSImport/Export generator.

Comment threadsrc/mono/wasm/runtime/net6-legacy/globalization-helper.ts Outdated
Comment threadsrc/mono/wasm/runtime/net6-legacy/globalization-helper.ts Outdated
Comment threadsrc/mono/wasm/runtime/net6-legacy/method-calls.ts Outdated
Comment threadsrc/mono/wasm/runtime/net6-legacy/method-calls.ts Outdated
kg
kg approved these changes Apr 5, 2023
@ilonatommy

Copy link
Copy Markdown
MemberAuthor

Failures not related. Merging to move forward. If there are any new ideas later, feel free to let me know and we will solve them in a follow-up, cc @pavelsavara, @radical.

@ilonatommy
ilonatommy merged commit d34a2a2 into dotnet:mainApr 7, 2023
@ghostghost locked as resolved and limited conversation to collaborators May 27, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasmWebAssembly architecturearea-System.Globalization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@ilonatommy@kg@mkhamoyan@krwq