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-21684 Fix performance issue in NumberRangeFormatter #1863

Merged
merged 1 commit into from
Sep 15, 2021

Conversation

sffc
Copy link
Member

@sffc sffc commented Sep 15, 2021

Checklist
  • Required: Issue filed: https://unicode-org.atlassian.net/browse/ICU-21684
  • Required: The PR title must be prefixed with a JIRA Issue number.
  • 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.
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable

@sffc sffc requested a review from richgillam September 15, 2021 05:40
@sffc sffc assigned richgillam and pedberg-icu and unassigned richgillam Sep 15, 2021
@sffc sffc requested review from pedberg-icu and removed request for richgillam September 15, 2021 17:43
// The following two lines of code should finish quickly.
lnf.formatFormattableRange({"-1e99999", status}, {"0", status}, status);
lnf.formatFormattableRange({"0", status}, {"1e99999", status}, status);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not actually generate an error if the execution time is long. Is the idea for anyone running the tests to just look at the logged execution time and do something if it seems too long? Maybe we should at least have a infoln stating that; but that would not affect CI tests. Maybe better to call uprv_getRawUTCtime() at the beginning and end of the test and generate an error if the difference is significantly greater than expected (i.e. 20 seconds?)

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem with checking clock time is that the clock time really differs a lot depending on the environment. Not only CPU speed, but also whether the library was built with ASAN, run with Valgrind, etc. So as of now I basically use this as a manual qualitative runtime test.

I can either:

  1. Remove the test, since the bug is fixed
  2. Keep the test and add a flaky clock time checker
  3. Keep the test as proposed

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, I guess #3 seems best.

// The following two lines of code should finish quickly.
lnf.formatRange(new BigDecimal("-1e99999"), new BigDecimal("0"));
lnf.formatRange(new BigDecimal("0"), new BigDecimal("1e99999"));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same idea as above about generating an error if execution too long...

@sffc sffc merged commit 13fb584 into unicode-org:main Sep 15, 2021
@sffc sffc deleted the ICU-21684-perf branch September 15, 2021 21:59
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