-
-
Notifications
You must be signed in to change notification settings - Fork 758
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
ICU-23000 Replace CharString for LocaleBased #3321
Conversation
b4f7597
to
8554c0a
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
8554c0a
to
3340c4c
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
3340c4c
to
02d31a0
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
02d31a0
to
eda7ebb
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
eda7ebb
to
04d3b3b
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
PTAL |
04d3b3b
to
e81ef87
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
e81ef87
to
264ca16
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
264ca16
to
af8ec91
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I like it now :-)
- I realized that the pending changes return nullptr in non-error cases; we should go back to returning an empty string as before -- hopefully I caught the relevant places in the code
- a few stylistic changes
1575d9d
to
951129b
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
951129b
to
f4c7d45
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
I'm sorry I'm getting to this late. Markus has already worked this PR over pretty thoroughly, so I may not be bringing anything useful to the party (or at least anything useful enough to justify reopening the PR or doing a follow-on PR). But I have a couple thoughts:
I can't deny the memory-usage advantages you're getting here-- this is clearly a big win over what we had before-- but I can't help wondering if At the very least, it might be nice to encapsulate the pointer-ness in a new But I'm fine if you don't do any of this, and I'm definitely fine if you just file a ticket to do it later. What you have is a clear improvement over what was there before. |
good point
Yes, it's very weird. It's really just a temporary helper for setting and fetching two common locale IDs. It would be more natural to have an additional base class for Format and BreakIterator etc., but I suspect that this hack was introduced because additional base classes are messy in C++ and add a vtable pointer.
The reason for using CharString here is mainly to stop having a fixed-size buffer, and to avoid adding manual, error-prone buffer-and-pointer-and-length management. It would be much better to have a string-by-value field, but CharString is internal, and used in public APIs, so the best we can do is forward-declare it in the public headers and have pointer fields.
The nullptr-for-empty-ID part is not really for saving memory but for keeping constructors manageable.
I think that that would suffer from the same internal vs. public API problem. It seems like a cleaner way around that would be to create a public-but- |
Would it need to be a base class, or could it just be a separate class that the client classes include as an inline member? Or are their uses too different for that?
Ick. I forgot about that. Okay, you've convinced me. It's probably not worth messing with further, at least right now. :-) |
A class-as-value-field should work. The class would have to be public-but- |
ok, I file a new bug to track that in https://unicode-org.atlassian.net/browse/ICU-23005 I will work on that. |
These changes improve the overall peak memory usage and slightly improve
performance
Raw data in
https://docs.google.com/spreadsheets/d/10LQ3kO83EwvsFfoiySTzsTbIzfUV00Te4jQnX0b_FM4/edit?usp=sharing
Checklist