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

Use UnvalidatedStr for casemap unfold keys #3690

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

Manishearth
Copy link
Member

We have two other strings in casemap on data that isn't hit often: the exceptions data and the unfold values are also strs.

@sffc @robertbastian what do you think of making those UnvalidatedStrs as well? We could GIGO when they're not. The nice thing is that people won't pay upfront costs about data that is not used often.

Unfold data is not too big, exceptions data is kinda big but also not all of it is rare to hit.

The main issue is that in the exception data multiple calls to get_char_slot() etc would have to reparse the string. But the string is likely to be small anyway.

Copy link
Member

@robertbastian robertbastian left a comment

Choose a reason for hiding this comment

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

I don't think we should make values unvalidated until we know that it's actually a performance improvement. We don't know much about real usage patterns.

@Manishearth Manishearth merged commit 244795e into unicode-org:main Jul 17, 2023
23 checks passed
@Manishearth Manishearth deleted the casemap-unvalidated branch July 17, 2023 15:26
@Manishearth
Copy link
Member Author

That makes sense to me.

(Merging this PR to get the change for keys in, which is unlikely to be controversial; for values I'm happy to continue discussion if others feel like we should do something there)

Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

For now let's use UnvalidatedStr in zeromap keys but not zeromap values assuming that the values will be used as strs.

@Manishearth
Copy link
Member Author

Manishearth commented Jul 19, 2023

(The values here are logically [char] stored as UTF8, not strings. But the same argument applies)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants