xzel23 commented on PR #582: URL: https://github.com/apache/poi/pull/582#issuecomment-1925445097
I think another (and maybe the main) reason might be the two step conversion and the creating of both a new character array and a new string instance creation in every step in the old code whereas in your code, you use Character.toString(int codepoint). Could you try out what happens in the old code if you replace `mapToObj(codePoint -> new String(Character.toChars(codePoint)))` with `mapToObj(Character::toString)`? However, that doesn't help much since the method you used was introduced in Java 11 whereas POI 4.x still is compatible with Java 8. So this cannot be applied at the moment. I have been inactive for quite some time on POI, but I think it would be about time to switch to (at least) Java 11 for POI 5 so this would be possible. Please change your code to this and report back how this compares to the old version: ``` public static Iterator<String> iteratorFor(String text) { PrimitiveIterator.OfInt iter = primitiveIterator(text); return new Iterator<String>() { @Override public boolean hasNext() { return iter.hasNext(); } @Override public String next() { return new String(Character.toChars(codePoint)); } }; ``` -- 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: dev-unsubscr...@poi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org