[jira] [Commented] (LANG-1675) Improve performance of StringUtils.join for primitives.

2021-10-09 Thread Hubert Wojciechowski (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17426568#comment-17426568
 ] 

Hubert Wojciechowski commented on LANG-1675:


PR created: 

[https://github.com/apache/commons-lang/pull/812]

 

JMH tests with example results are here:

[https://github.com/HubertWo/apache-commons-lang-jmh] 

> Improve performance of StringUtils.join for primitives.
> ---
>
> Key: LANG-1675
> URL: https://issues.apache.org/jira/browse/LANG-1675
> Project: Commons Lang
>  Issue Type: Improvement
>Reporter: Hubert Wojciechowski
>Priority: Minor
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> This is [~XenoAmess] comment from PR:  
> [https://github.com/apache/commons-lang/pull/784] 
> {noformat}
> 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.
> {noformat}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (LANG-1675) Improve performance of StringUtils.join for primitives.

2021-10-09 Thread Hubert Wojciechowski (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17426535#comment-17426535
 ] 

Hubert Wojciechowski commented on LANG-1675:


I'm on it. 

Right now the draft of the fix may be found here: 
https://github.com/HubertWo/commons-lang/pull/4

> Improve performance of StringUtils.join for primitives.
> ---
>
> Key: LANG-1675
> URL: https://issues.apache.org/jira/browse/LANG-1675
> Project: Commons Lang
>  Issue Type: Improvement
>Reporter: Hubert Wojciechowski
>Priority: Minor
>
> This is [~XenoAmess] comment from PR:  
> [https://github.com/apache/commons-lang/pull/784] 
> {noformat}
> 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.
> {noformat}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (LANG-1675) Improve performance of StringUtils.join for primitives.

2021-10-06 Thread Hubert Wojciechowski (Jira)
Hubert Wojciechowski created LANG-1675:
--

 Summary: Improve performance of StringUtils.join for primitives.
 Key: LANG-1675
 URL: https://issues.apache.org/jira/browse/LANG-1675
 Project: Commons Lang
  Issue Type: Improvement
Reporter: Hubert Wojciechowski


This is [~XenoAmess] comment from PR:  
[https://github.com/apache/commons-lang/pull/784] 


{noformat}
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.
{noformat}

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2021-08-20 Thread Hubert Wojciechowski (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17402543#comment-17402543
 ] 

Hubert Wojciechowski commented on LANG-1593:


h3. Evidences
{code:java}
hubert@mac target % jshell -class-path './commons-lang3-3.13.0-SNAPSHOT.jar'
|  Welcome to JShell -- Version 16
|  For an introduction type: /help intro

jshell> import org.apache.commons.lang3.StringUtils

jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7};
arr ==> int[7] { 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 ==> "1-2-3-4-5-6-7"
{code}

> 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: 4h 10m
>  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)


[jira] [Commented] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2021-08-20 Thread Hubert Wojciechowski (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17402541#comment-17402541
 ] 

Hubert Wojciechowski commented on LANG-1593:


[~erans]
All changes ready. Build is green. 
Please check if you find a moment. 
https://github.com/apache/commons-lang/pull/784

> 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: 4h 10m
>  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)


[jira] [Commented] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2021-08-05 Thread Hubert Wojciechowski (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17394274#comment-17394274
 ] 

Hubert Wojciechowski commented on LANG-1593:


Changes are ready.
Please review when you will find a moment. 
https://github.com/apache/commons-lang/pull/784

> 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: 3h 40m
>  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)


[jira] [Commented] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2021-08-04 Thread Hubert Wojciechowski (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17393438#comment-17393438
 ] 

Hubert Wojciechowski commented on LANG-1593:


Draft PR created: https://github.com/apache/commons-lang/pull/784
Solution is ready. The only missing thing is Javadoc for some methods. 

Looks like build for Java 16 and Java 17 is broken - please check main branch 
build or any PR. 

> 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: 1h 50m
>  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)


[jira] [Commented] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2021-07-22 Thread Hubert Wojciechowski (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17385543#comment-17385543
 ] 

Hubert Wojciechowski commented on LANG-1593:


Thank you for an answer. I will prepare new PR within few days.

> 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: 1h 50m
>  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)


[jira] [Commented] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2021-07-21 Thread Hubert Wojciechowski (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17384922#comment-17384922
 ] 

Hubert Wojciechowski commented on LANG-1593:


[~erans] I prepared fix for this some time ago it got outdated. Anyone cares 
this to be fixed? If yes, I can checkout and push another PR since the changes 
are ready. 

> 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: 1h 50m
>  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)


[jira] [Commented] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2020-10-28 Thread Hubert Wojciechowski (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17222338#comment-17222338
 ] 

Hubert Wojciechowski commented on LANG-1593:


I have added new methods for all of the Java primitives, 
{code:java}
public static String join(final int[] array, final String separator)
{code}
and
{code:java}
public static String join(final int[] array, final String separator, final int 
startIndex, final int endIndex)
{code}
 All methods with char as argument were changed to
{code:java}
public static String join(final byte[] array, final char separator, final int 
startIndex, final int endIndex) {
return join(array, Character.toString(separator), startIndex, endIndex);
} 
{code}
 

 

> 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: 10m
>  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)


[jira] [Comment Edited] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2020-10-28 Thread Hubert Wojciechowski (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17222338#comment-17222338
 ] 

Hubert Wojciechowski edited comment on LANG-1593 at 10/28/20, 6:31 PM:
---

I have added new methods for all of the Java primitives, 
{code:java}
public static String join(final int[] array, final String separator)
{code}
and
{code:java}
public static String join(final int[] array, final String separator, final int 
startIndex, final int endIndex)
{code}
 All methods with char as argument were changed to
{code:java}
public static String join(final byte[] array, final char separator, final int 
startIndex, final int endIndex) {
return join(array, Character.toString(separator), startIndex, endIndex);
} 
{code}


was (Author: hubertwo):
I have added new methods for all of the Java primitives, 
{code:java}
public static String join(final int[] array, final String separator)
{code}
and
{code:java}
public static String join(final int[] array, final String separator, final int 
startIndex, final int endIndex)
{code}
 All methods with char as argument were changed to
{code:java}
public static String join(final byte[] array, final char separator, final int 
startIndex, final int endIndex) {
return join(array, Character.toString(separator), startIndex, endIndex);
} 
{code}
 

 

> 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: 10m
>  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)