-
Notifications
You must be signed in to change notification settings - Fork 445
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
OPENNLP-1285: Fix Java 8 vs 11 test inconsistencies #377
Conversation
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.
Looks good to me. I wonder what's the performance penalty for this change? Hopefully small enough that it compensates to have the builds more reproducible. 👍
@@ -410,7 +410,7 @@ public void evalParserModel() throws Exception { | |||
} | |||
} | |||
|
|||
Assert.assertEquals(new BigInteger("312218841713337505306598301082074515847"), | |||
Assert.assertEquals(new BigInteger("68039262350771988792233880373220954061"), |
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.
The change of precision in the other tests was small compared to this one. This was the only thing that got my eye from reading the changes here. Pretty much everything else appears to be just s/Math/StrictMath.
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 will double-check that one and make sure that value is correct.
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.
@kinow This number changed a lot because it is an MD5 hash value. Looks like the test is using the parser chunking model to parse the leipzig/eng_news_2010_300K-sentences.txt
input file. At the end it computes the hash of the parse string and compares it to an expected value.
StrictMath
must be causing a difference that's visible in the hash value. I'm guessing it's probably like those other tests where it's a small rounding difference somewhere.
I did verify that 68039262350771988792233880373220954061
is the same value on Java 8 and Java 11.
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.
Ah, got it @jzonthemtn , had no idea it was a md5 hash. All good then 🥇 👍
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.
+1 lgtm. I performed a test with the tokenizer to see if this changes makes it slower, the runtime was almost identical and I didn't notice a slow down. The change is a big win if this helps to make test run more reliable across JVM versions and different CPUs.
This also fixed OPENNLP-1113. |
Thank you for contributing to Apache OpenNLP.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with OPENNLP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically master)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.