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

ICU-23000 Replace CharString for LocaleBased #3321

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FrankYFTang
Copy link
Contributor

@FrankYFTang FrankYFTang commented Dec 24, 2024

These changes improve the overall peak memory usage and slightly improve
performance

	main avg	main stdev	branch avg	branch stdev	diff avg	diff avg %
User time (seconds):	81.19	0.37	81.36	0.09	0.17	0.21%
System time (seconds):	5.03	0.08	4.86	0.05	-0.17	-3.38%
Percent of CPU this job got:	237.33%	0.01	235.33%	0.01	-2.00%	-0.84%
Maximum resident set size (kbytes):	227,141	99.14	226,667	366.48	-475	-0.21%
Minor (reclaiming a frame) page faults:	46,009	510.78	43,775	294.47	-2,234	-4.86%
Voluntary context switches:	333,442	4513.76	316,506	8850.48	-16,936	-5.08%
Involuntary context switches:	467	30.60	515	22.65	48	10.36%

Raw data in
https://docs.google.com/spreadsheets/d/10LQ3kO83EwvsFfoiySTzsTbIzfUV00Te4jQnX0b_FM4/edit?usp=sharing

Checklist

  • Required: Issue filed: ICU-23000
  • Required: The PR title must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
  • Required: Each commit message must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable

@FrankYFTang FrankYFTang added the incomplete Needs work; do not approve/merge as is. label Dec 24, 2024
@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang FrankYFTang removed the incomplete Needs work; do not approve/merge as is. label Dec 26, 2024
@FrankYFTang FrankYFTang changed the title Replace CharString for LocaleBased ICU-23000 Replace CharString for LocaleBased Dec 26, 2024
FrankYFTang added a commit to FrankYFTang/icu that referenced this pull request Dec 26, 2024
@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

FrankYFTang added a commit to FrankYFTang/icu that referenced this pull request Dec 26, 2024
@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@markusicu markusicu self-assigned this Dec 26, 2024
@markusicu markusicu requested a review from richgillam December 26, 2024 23:54
icu4c/source/common/brkiter.cpp Outdated Show resolved Hide resolved
icu4c/source/common/brkiter.cpp Outdated Show resolved Hide resolved
icu4c/source/common/locbased.h Outdated Show resolved Hide resolved

/**
* Construct a LocaleBased wrapper around the two const pointers.
* These will be aliased for the lifetime of this object.
*/
inline LocaleBased(const char* validAlias, const char* actualAlias);
inline LocaleBased(const CharString* validAlias, const CharString* actualAlias);
Copy link
Member

Choose a reason for hiding this comment

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

This, and the implementation which casts away const, looks wrong.
None of the classes that use LocaleBased should have const CharString.

Please try to remove this constructor completely.

Comment on lines 45 to 46
valid->clear();
valid->append(validID, -1, status);
Copy link
Member

Choose a reason for hiding this comment

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

Hm. We should really have a CharString function overload

    CharString &copyFrom(StringPiece s, UErrorCode &errorCode);

to simplify such call sites. In particular, that would eliminate error checking because it wouldn't clear & replace when there is already a failure.

I can work on that as a follow-up if you like.

icu4c/source/i18n/calendar.cpp Show resolved Hide resolved
icu4c/source/i18n/calendar.cpp Outdated Show resolved Hide resolved
icu4c/source/i18n/dcfmtsym.cpp Show resolved Hide resolved
icu4c/source/i18n/dtfmtsym.cpp Show resolved Hide resolved
icu4c/source/i18n/format.cpp Show resolved Hide resolved
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4c/source/common/brkiter.cpp is different
  • icu4c/source/common/charstr.cpp is now changed in the branch
  • icu4c/source/common/charstr.h is now changed in the branch
  • icu4c/source/common/locbased.cpp is different
  • icu4c/source/common/locbased.h is different
  • icu4c/source/i18n/calendar.cpp is different
  • icu4c/source/i18n/dcfmtsym.cpp is different
  • icu4c/source/i18n/dtfmtsym.cpp is different
  • icu4c/source/i18n/format.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4c/source/i18n/calendar.cpp is different
  • icu4c/source/i18n/dtfmtsym.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang
Copy link
Contributor Author

PTAL

The changes improve the overall peak memory usage and slightly improve
performance

	main avg	main stdev	branch avg	branch stdev	diff avg	diff avg %
User time (seconds):	81.19	0.37	81.36	0.09	0.17	0.21%
System time (seconds):	5.03	0.08	4.86	0.05	-0.17	-3.38%
Percent of CPU this job got:	237.33%	0.01	235.33%	0.01	-2.00%	-0.84%
Maximum resident set size (kbytes):	227,141	99.14	226,667	366.48	-475	-0.21%
Minor (reclaiming a frame) page faults:	46,009	510.78	43,775	294.47	-2,234	-4.86%
Voluntary context switches:	333,442	4513.76	316,506	8850.48	-16,936	-5.08%
Involuntary context switches:	467	30.60	515	22.65	48	10.36%

Raw data in
https://docs.google.com/spreadsheets/d/10LQ3kO83EwvsFfoiySTzsTbIzfUV00Te4jQnX0b_FM4/edit?usp=sharing
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4c/source/common/brkiter.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

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