asdfgh19 opened a new pull request, #4714: URL: https://github.com/apache/hadoop/pull/4714
### Description of PR JIRA: [HADOOP-18395](https://issues.apache.org/jira/browse/HADOOP-18395) The current implementation reset src and tgt to the mark and continues searching when tgt has remaining and src expired first. which is probably not necessary. In some cases, this commit can reduce the complexity from O(n²) to O(n), which can significantly improve performance, as in the following example. ```java public void testFindWithTimeout() throws Exception { byte[] bytes = new byte[1000000]; Arrays.fill(bytes, (byte) 97); String what = new String(bytes); bytes[0] = (byte) 98; Text text = new Text(bytes); assertThat(text.find(what)).isEqualTo(-1); } ``` ### How was this patch tested? unit test in org.apache.hadoop.io.TestText#testFind -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org