[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=663165&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-663165 ]
ASF GitHub Bot logged work on LANG-1593: ---------------------------------------- Author: ASF GitHub Bot Created on: 09/Oct/21 10:58 Start Date: 09/Oct/21 10:58 Worklog Time Spent: 10m Work Description: HubertWo edited a comment on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-936515051 > > @XenoAmess Could you please be more descriptive? The only `String.valueOf` I have added are in high level methods, main logic does not. Actually I removed `String.valueOf` from loops. Sorry for answering in comment, but there's no way to add reply to your comment. > > @HubertWo > > Hi. > > I find some time today for this question (finally). > > `The only `String.valueOf` I have added are in high level methods, main logic does not` > > This statement be correct, but also be where I worried about performance. > > Please look at the sources in JDK, where `java.lang.AbstractStringBuilder#append(boolean b)` > > In short, for basic types, should not convert them to String, but use StringBuilder directly, will bring far better performance. > > BUT I just foundout that you did not bring this issue, this issue is already in commons-lang before your pr. > > So I will not stop you from merging this in, but still I will find time to refactor the whole `join` serial functions later. I was not aware of that. I will be happy to introduce changes (with JMH tests) related to your suggestions in separate PR. I've crated new JIRA for it: https://issues.apache.org/jira/browse/LANG-1675 Thank you for your time @XenoAmess . Update: I've created PR with StringBuilder in StringUtils.join and JMH benchmarks. Please find it here: https://github.com/apache/commons-lang/pull/812 -- 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: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 663165) Time Spent: 8h 20m (was: 8h 10m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > ------------------------------------------------------------------------------------ > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement > Affects Versions: 3.4, 3.11 > Reporter: Kiruahxh > Priority: Minor > Time Spent: 8h 20m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)