Skip to content
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

Ensure CodePointTrie access by u16 or char omits unnecessary range checks #5819

Open
hsivonen opened this issue Nov 14, 2024 · 1 comment
Open
Labels
A-performance Area: Performance (CPU, Memory) discuss-priority Discuss at the next ICU4X meeting

Comments

@hsivonen
Copy link
Member

When CodePointTrie of the fast type is queried with u16, the code point cannot be above FAST_TYPE_FAST_INDEXING_MAX. When CodePointTrie (of either type) is queried with char, the code point cannot be above CODE_POINT_MAX.

We should ensure that the relevant branches are omitted in these cases. Perhaps its good enough to ensure this by Godbolting, but actually having separate code for these cases would be robust (not relying on the optimizer reaching a particular conclusion) and obvious.

@hsivonen hsivonen added A-performance Area: Performance (CPU, Memory) discuss-priority Discuss at the next ICU4X meeting labels Nov 14, 2024
@hsivonen
Copy link
Member Author

Godbolting suggests that this optimizes the right way already. (Used trivial examples, not the actual CodePointTrie code.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-performance Area: Performance (CPU, Memory) discuss-priority Discuss at the next ICU4X meeting
Projects
None yet
Development

No branches or pull requests

1 participant