[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2021-02-21 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=555462&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-555462
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 21/Feb/21 16:48
Start Date: 21/Feb/21 16:48
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-650908222


   
   [![Coverage 
Status](https://coveralls.io/builds/37305267/badge)](https://coveralls.io/builds/37305267)
   
   Coverage increased (+0.0003%) to 94.958% when pulling 
**46350d4300c33f1821ea7d7cc561e4e348233736 on xenoamess-fork:refine_chomp** 
into **8d35d66ba9fe71e9f7bc853425e4bce13c961283 on apache:master**.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 555462)
Time Spent: 8h 20m  (was: 8h 10m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 8h 20m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2021-02-21 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=555460&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-555460
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 21/Feb/21 16:47
Start Date: 21/Feb/21 16:47
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-650908222


   
   [![Coverage 
Status](https://coveralls.io/builds/37305258/badge)](https://coveralls.io/builds/37305258)
   
   Coverage increased (+0.0003%) to 94.958% when pulling 
**46350d4300c33f1821ea7d7cc561e4e348233736 on xenoamess-fork:refine_chomp** 
into **8d35d66ba9fe71e9f7bc853425e4bce13c961283 on apache:master**.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 555460)
Time Spent: 8h 10m  (was: 8h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 8h 10m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2021-02-21 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=555454&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-555454
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 21/Feb/21 16:39
Start Date: 21/Feb/21 16:39
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-782885981


   @garydgregory rebased. please find some time to review. thanks.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 555454)
Time Spent: 8h  (was: 7h 50m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 8h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=471356&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-471356
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 17/Aug/20 06:04
Start Date: 17/Aug/20 06:04
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-650908222


   
   [![Coverage 
Status](https://coveralls.io/builds/32792965/badge)](https://coveralls.io/builds/32792965)
   
   Coverage increased (+0.04%) to 94.705% when pulling 
**e8eb61c2ebdcda7c0067f95c0e0aedaaf49ce91c on XenoAmess:refine_chomp** into 
**cf0bc2b5dbb08ee1f5c0c8d54df307e23345544d on apache:master**.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 471356)
Time Spent: 7h 50m  (was: 7h 40m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 7h 50m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=471353&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-471353
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 17/Aug/20 05:54
Start Date: 17/Aug/20 05:54
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-674672119


   Hi.
   I added some more lengths of Strings to the benchmark, as suggested by 
@sebbASF . Thanks.
   full benchmark at https://pastebin.ubuntu.com/p/yPH4xnKqZd/
   In short,
   ```
   Benchmark   (data)  (name)  Mode 
 Cnt  Score  Error  Units
   StringUtilsChompTest.singleString NULL old  avgt 
   5  3.246 ?   0.091  ns/op
   
   StringUtilsChompTest.singleString NULL new  avgt 
   5  3.265 ?   0.153  ns/op
   
   StringUtilsChompTest.singleStringCHAR0 old  avgt 
   5  3.901 ?   0.251  ns/op
   
   StringUtilsChompTest.singleStringCHAR0 new  avgt 
   5  3.863 ?   0.769  ns/op
   
   StringUtilsChompTest.singleString CHAR0_CR old  avgt 
   5  4.393 ?   0.519  ns/op
   
   StringUtilsChompTest.singleString CHAR0_CR new  avgt 
   5  4.335 ?   0.393  ns/op
   
   StringUtilsChompTest.singleString CHAR0_LF old  avgt 
   5  4.279 ?   0.295  ns/op
   
   StringUtilsChompTest.singleString CHAR0_LF new  avgt 
   5  4.315 ?   0.230  ns/op
   
   StringUtilsChompTest.singleString  CHAR0_CR_LF old  avgt 
   5 10.768 ?   0.643  ns/op
   
   StringUtilsChompTest.singleString  CHAR0_CR_LF new  avgt 
   5  9.901 ?   0.136  ns/op
   
   StringUtilsChompTest.singleStringCHAR1 old  avgt 
   5  4.358 ?   0.257  ns/op
   
   StringUtilsChompTest.singleStringCHAR1 new  avgt 
   5  3.989 ?   0.117  ns/op
   
   StringUtilsChompTest.singleString CHAR1_CR old  avgt 
   5 19.181 ?   0.715  ns/op
   
   StringUtilsChompTest.singleString CHAR1_CR new  avgt 
   5 19.502 ?   1.590  ns/op
   
   StringUtilsChompTest.singleString CHAR1_LF old  avgt 
   5 20.168 ?   1.003  ns/op
   
   StringUtilsChompTest.singleString CHAR1_LF new  avgt 
   5 19.578 ?   0.575  ns/op
   
   StringUtilsChompTest.singleString  CHAR1_CR_LF old  avgt 
   5 19.984 ?   1.332  ns/op
   
   StringUtilsChompTest.singleString  CHAR1_CR_LF new  avgt 
   5 19.834 ?   1.017  ns/op
   
   StringUtilsChompTest.singleStringCHAR2 old  avgt 
   5  4.408 ?   0.098  ns/op
   
   StringUtilsChompTest.singleStringCHAR2 new  avgt 
   5  4.033 ?   0.231  ns/op
   
   StringUtilsChompTest.singleString CHAR2_CR old  avgt 
   5 19.056 ?   1.116  ns/op
   
   StringUtilsChompTest.singleString CHAR2_CR new  avgt 
   5 18.928 ?   0.903  ns/op
   
   StringUtilsChompTest.singleString CHAR2_LF old  avgt 
   5 21.658 ?   2.624  ns/op
   
   StringUtilsChompTest.singleString CHAR2_LF new  avgt 
   5 20.125 ?   1.185  ns/op
   
   StringUtilsChompTest.singleString  CHAR2_CR_LF old  avgt 
   5 19.865 ?   0.865  ns/op
   
   StringUtilsChompTest.singleString  CHAR2_CR_LF new  avgt 
   5 20.033 ?   1.695  ns/op
   
   StringUtilsChompTest.singleString CHAR1024 old  avgt 
   5  4.469 ?   0.186  ns/op
   
   StringUtilsChompTest.singleString CHAR1024 new  avgt 
   5  4.051 ?   0.146  ns/op
   
   StringUtilsChompTest.singleString  CHAR1024_CR old  avgt 
   5102.333 ?   1.823  ns/op
   
   StringUtilsChompTest.singleString  CHAR1024_CR new  avgt 
   5102.237 ?   0.913  ns/op
   
   StringUtilsChompTest.singleString  CHAR1024_LF old  avgt 
   5104.155 ?   2.604  ns/op
   
   StringUtilsChompTest.singleString  CHAR1024_LF new  avgt 
   5103.365 ?   2.392  ns/op
   
   StringUtilsChompTest.singleString   CHAR1024_CR_LF old  avgt 
   5103.665 ?   4.241  ns/op
   
   StringUtilsChompTest.singleString   CHAR1024_CR_LF new  avgt 
   5103.453 ?   1.482  ns/op
   
   StringUtilsChompTest.singleStringCHAR10240 old  avgt 
   5  4.772 ?   1.314  ns/op
   
   StringUtilsChompTest.

[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=471216&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-471216
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 16/Aug/20 14:21
Start Date: 16/Aug/20 14:21
Worklog Time Spent: 10m 
  Work Description: sebbASF commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-674532472


   You are correct - I was forgetting that the characters could be missing.
   
   As to testing the length, yes I think we do need to test for various lengths.
   Longer substrings may take longer to create; if that is true it should show 
that the new code is better.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 471216)
Time Spent: 7.5h  (was: 7h 20m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 7.5h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=471214&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-471214
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 16/Aug/20 13:38
Start Date: 16/Aug/20 13:38
Worklog Time Spent: 10m 
  Work Description: XenoAmess edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-674527661


   @sebbASF
   
   > I think the current huge list of input strings is more about testing 
functionality rather than performance.
   > 
   > The method only cares about 3 characters: CR, LF or something else (unless 
it has a bug).
   > So the performance test needs to check those in various combinations. I 
think that is just 9 combinations.
   
   Not really.
   More cases are:
   1. null string.
   2. string of length 0 ("")
   3. string of length 1 who ends with '\r'
   4. string of length 1 who ends with '\n'
   5. string of length 1 who ends with normal char
   
   While 3,4,5 be actually handled by a same `if`, I'd prefer hanle them 
seperately.
   So do 1 and 2.
   
   > It also needs to test the length, because that is used when doing the 
substring.
   > The method is likely to be used with textual input so it would make sense 
to try with a selection of lengths.
   > Not sure what the maximum should be, probably at least 1000, maybe 
considerably more.
   > It might make sense to do these as separate tests to see if the length 
affects the performance.
   
   So you mean we should add test for some specific length of strings?
   For example, "a"*1024, "a"*10240" and "a"*102400"?
   Fine, then I will add/rerun it if you need this data, at later today.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 471214)
Time Spent: 7h 20m  (was: 7h 10m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 7h 20m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-16 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=471213&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-471213
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 16/Aug/20 13:37
Start Date: 16/Aug/20 13:37
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-674527661


   > I think the current huge list of input strings is more about testing 
functionality rather than performance.
   > 
   > The method only cares about 3 characters: CR, LF or something else (unless 
it has a bug).
   > So the performance test needs to check those in various combinations. I 
think that is just 9 combinations.
   
   Not really.
   More cases are:
   1. null string.
   2. string of length 0 ("")
   3. string of length 1 who ends with '\r'
   4. string of length 1 who ends with '\n'
   5. string of length 1 who ends with normal char
   
   While 3,4,5 be actually handled by a same `if`, I'd prefer hanle them 
seperately.
   So do 1 and 2.
   
   > It also needs to test the length, because that is used when doing the 
substring.
   > The method is likely to be used with textual input so it would make sense 
to try with a selection of lengths.
   > Not sure what the maximum should be, probably at least 1000, maybe 
considerably more.
   > It might make sense to do these as separate tests to see if the length 
affects the performance.
   
   So you mean we should add test for some specific length of strings?
   For example, "a"*1024, "a"*10240" and "a"*102400"?
   Fine, then I will add/rerun it if you need this data, at later today.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 471213)
Time Spent: 7h 10m  (was: 7h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 7h 10m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=471050&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-471050
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 15/Aug/20 09:10
Start Date: 15/Aug/20 09:10
Worklog Time Spent: 10m 
  Work Description: sebbASF commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-674371834


   I think the current huge list of input strings is more about testing 
functionality rather than performance.
   
   The method only cares about 3 characters: CR, LF or something else (unless 
it has a bug).
   So the performance test needs to check those in various combinations. I 
think that is just 9 combinations.
   
   It also needs to test the length, because that is used when doing the 
substring.
   The method is likely to be used with textual input so it would make sense to 
try with a selection of lengths.
   Not sure what the maximum should be, probably at least 1000, maybe 
considerably more.
   It might make sense to do these as separate tests to see if the length 
affects the performance.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 471050)
Time Spent: 7h  (was: 6h 50m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 7h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-14 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=470994&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-470994
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 15/Aug/20 04:06
Start Date: 15/Aug/20 04:06
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-674345393


   @sebbASF 
   Hi.
   
   > Sorry, I see now that the strings do have a mix of CR and LF endings (or 
neither).
   > However, the strings are all of length 2.
   > The strings are not representative of the likely use cases.
   
   The behaviour of the method depends only on the last one or two characters 
(and the length).
   And I don't think add more chars will help.
   If we increase the length to some normal length of our usecases (for example 
6) it will be a really large test.
   
   
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 470994)
Time Spent: 6h 50m  (was: 6h 40m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 6h 50m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-11 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=469124&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-469124
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 11/Aug/20 09:09
Start Date: 11/Aug/20 09:09
Worklog Time Spent: 10m 
  Work Description: sebbASF commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-671828303


   Sorry, I see now that the strings do have a mix of CR and LF endings (or 
neither).
   However, the strings are all of length 2.
   The strings are not representative of the likely use cases.
   
   As to the change itself, it looks fine, but IMO the benchmark needs some 
work.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 469124)
Time Spent: 6h 40m  (was: 6.5h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 6h 40m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-10 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468598&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468598
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 10/Aug/20 14:08
Start Date: 10/Aug/20 14:08
Worklog Time Spent: 10m 
  Work Description: XenoAmess edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-671376780


   @sebbASF 
   > I don't think the RandomStrings test is a fair benchmark.
   
   Actually it is fair.
   see the string array generation function of that test.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468598)
Time Spent: 6h 20m  (was: 6h 10m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 6h 20m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-10 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468597&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468597
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 10/Aug/20 14:08
Start Date: 10/Aug/20 14:08
Worklog Time Spent: 10m 
  Work Description: XenoAmess edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-671376780


   @sebbASF 
   > I don't think the RandomStrings test is a fair benchmark.
   
   It is fair.
   see the string array generation function of that test.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468597)
Time Spent: 6h 10m  (was: 6h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 6h 10m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-10 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468599&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468599
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 10/Aug/20 14:08
Start Date: 10/Aug/20 14:08
Worklog Time Spent: 10m 
  Work Description: XenoAmess edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-671376780


   @sebbASF 
   > I don't think the RandomStrings test is a fair benchmark.
   
   Actually it is fair.
   See the string array generation function of that test.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468599)
Time Spent: 6.5h  (was: 6h 20m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 6.5h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-10 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468596&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468596
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 10/Aug/20 14:07
Start Date: 10/Aug/20 14:07
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-671376780


   @sebbASF 
   > I don't think the RandomStrings test is a fair benchmark.
   It is fair.
   see the string array generation function of that test.
   
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468596)
Time Spent: 6h  (was: 5h 50m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 6h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-10 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468487&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468487
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 10/Aug/20 10:06
Start Date: 10/Aug/20 10:06
Worklog Time Spent: 10m 
  Work Description: sebbASF commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-671269648


   Thanks - much easier to see what has been changed now.
   i.e. cache the string length, and don't use substring unless it is needed.
   
   I don't think the RandomStrings test is a fair benchmark.
   The behaviour of the method depends only on the last one or two characters 
(and the length).
   AFAICT the strings are not random and don't have a mix of line-endings.
   So I think the test only measures the efficiency of String.substring where 
nothing needs to be dropped.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468487)
Time Spent: 5h 50m  (was: 5h 40m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 5h 50m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468426&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468426
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 10/Aug/20 05:26
Start Date: 10/Aug/20 05:26
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-650908222


   
   [![Coverage 
Status](https://coveralls.io/builds/32638166/badge)](https://coveralls.io/builds/32638166)
   
   Coverage decreased (-0.0003%) to 94.665% when pulling 
**ab0c42774b1bc5dc5b060ec3d48f73726d960955 on XenoAmess:refine_chomp** into 
**cf0bc2b5dbb08ee1f5c0c8d54df307e23345544d on apache:master**.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468426)
Time Spent: 5h 40m  (was: 5.5h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 5h 40m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468406&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468406
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 10/Aug/20 04:52
Start Date: 10/Aug/20 04:52
Worklog Time Spent: 10m 
  Work Description: XenoAmess edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-671160146


   Hi.
   I re-changed some codes and run a performance test.
   In short,
   ```
   Benchmark  (data)  (name)  Mode  Cnt 
 Score  Error  Units
   StringUtilsChompTest.singleStringNULL old  avgt5 
 2.751 ?   0.091  ns/op
   
   StringUtilsChompTest.singleStringNULL new  avgt5 
 2.767 ?   0.182  ns/op
   
   StringUtilsChompTest.singleString   CHAR0 old  avgt5 
 3.687 ?   2.040  ns/op
   
   StringUtilsChompTest.singleString   CHAR0 new  avgt5 
 3.221 ?   0.070  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_CR old  avgt5 
 3.757 ?   0.249  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_CR new  avgt5 
 3.718 ?   0.171  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_LF old  avgt5 
 3.780 ?   0.362  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_LF new  avgt5 
 3.829 ?   0.456  ns/op
   
   StringUtilsChompTest.singleString CHAR0_CR_LF old  avgt5 
 9.466 ?   0.550  ns/op
   
   StringUtilsChompTest.singleString CHAR0_CR_LF new  avgt5 
 9.506 ?   0.441  ns/op
   
   StringUtilsChompTest.singleString   CHAR1 old  avgt5 
 4.035 ?   1.104  ns/op
   
   StringUtilsChompTest.singleString   CHAR1 new  avgt5 
 3.780 ?   0.239  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_CR old  avgt5 
18.910 ?   2.074  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_CR new  avgt5 
19.492 ?   1.942  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_LF old  avgt5 
19.429 ?   1.860  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_LF new  avgt5 
22.080 ?   6.952  ns/op
   
   StringUtilsChompTest.singleString CHAR1_CR_LF old  avgt5 
22.026 ?   2.968  ns/op
   
   StringUtilsChompTest.singleString CHAR1_CR_LF new  avgt5 
18.868 ?   1.075  ns/op
   
   StringUtilsChompTest.singleString   CHAR2 old  avgt5 
 4.068 ?   0.168  ns/op
   
   StringUtilsChompTest.singleString   CHAR2 new  avgt5 
 3.896 ?   0.361  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_CR old  avgt5 
17.723 ?   0.809  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_CR new  avgt5 
19.235 ?   0.502  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_LF old  avgt5 
21.363 ?   1.176  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_LF new  avgt5 
21.182 ?   1.029  ns/op
   
   StringUtilsChompTest.singleString CHAR2_CR_LF old  avgt5 
21.532 ?   1.032  ns/op
   
   StringUtilsChompTest.singleString CHAR2_CR_LF new  avgt5 
21.420 ?   2.569  ns/op
   
   StringUtilsChompTest.test_Random_Strings_New  N/A N/A  avgt5 
 70565.068 ?2096.854  ns/op
   
   StringUtilsChompTest.test_Random_Strings_Old  N/A N/A  avgt5 
 77950.673 ?2115.093  ns/op
   ```
detailed report at https://pastebin.ubuntu.com/p/bTNkPGpSpV/
   
   @sebbASF yes, the performance test shows the original condition struction is 
not bad as I thought at beginning, and revert to original condition struction 
will not harm performance.
   so according to the "minimal change" principle, I changed the codes to looks 
more likely to original.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468406)
Time Spent: 5.5h  (was: 5h 20m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>

[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468403&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468403
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 10/Aug/20 04:48
Start Date: 10/Aug/20 04:48
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-671160146


   Hi.
   I re-changed some codes and run a performance test.
   In short,
   ```
   Benchmark  (data)  (name)  Mode  Cnt 
 Score  Error  Units
   StringUtilsChompTest.singleStringNULL old  avgt5 
 2.751 ?   0.091  ns/op
   
   StringUtilsChompTest.singleStringNULL new  avgt5 
 2.767 ?   0.182  ns/op
   
   StringUtilsChompTest.singleString   CHAR0 old  avgt5 
 3.687 ?   2.040  ns/op
   
   StringUtilsChompTest.singleString   CHAR0 new  avgt5 
 3.221 ?   0.070  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_CR old  avgt5 
 3.757 ?   0.249  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_CR new  avgt5 
 3.718 ?   0.171  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_LF old  avgt5 
 3.780 ?   0.362  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_LF new  avgt5 
 3.829 ?   0.456  ns/op
   
   StringUtilsChompTest.singleString CHAR0_CR_LF old  avgt5 
 9.466 ?   0.550  ns/op
   
   StringUtilsChompTest.singleString CHAR0_CR_LF new  avgt5 
 9.506 ?   0.441  ns/op
   
   StringUtilsChompTest.singleString   CHAR1 old  avgt5 
 4.035 ?   1.104  ns/op
   
   StringUtilsChompTest.singleString   CHAR1 new  avgt5 
 3.780 ?   0.239  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_CR old  avgt5 
18.910 ?   2.074  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_CR new  avgt5 
19.492 ?   1.942  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_LF old  avgt5 
19.429 ?   1.860  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_LF new  avgt5 
22.080 ?   6.952  ns/op
   
   StringUtilsChompTest.singleString CHAR1_CR_LF old  avgt5 
22.026 ?   2.968  ns/op
   
   StringUtilsChompTest.singleString CHAR1_CR_LF new  avgt5 
18.868 ?   1.075  ns/op
   
   StringUtilsChompTest.singleString   CHAR2 old  avgt5 
 4.068 ?   0.168  ns/op
   
   StringUtilsChompTest.singleString   CHAR2 new  avgt5 
 3.896 ?   0.361  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_CR old  avgt5 
17.723 ?   0.809  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_CR new  avgt5 
19.235 ?   0.502  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_LF old  avgt5 
21.363 ?   1.176  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_LF new  avgt5 
21.182 ?   1.029  ns/op
   
   StringUtilsChompTest.singleString CHAR2_CR_LF old  avgt5 
21.532 ?   1.032  ns/op
   
   StringUtilsChompTest.singleString CHAR2_CR_LF new  avgt5 
21.420 ?   2.569  ns/op
   
   StringUtilsChompTest.test_Random_Strings_New  N/A N/A  avgt5 
 70565.068 ?2096.854  ns/op
   
   StringUtilsChompTest.test_Random_Strings_Old  N/A N/A  avgt5 
 77950.673 ?2115.093  ns/op
   ```
detailed report at https://pastebin.ubuntu.com/p/bTNkPGpSpV/



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468403)
Time Spent: 5h 20m  (was: 5h 10m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 5h 20m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468402&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468402
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 10/Aug/20 04:47
Start Date: 10/Aug/20 04:47
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r467686209



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.infra.Blackhole;
+
+import java.util.concurrent.TimeUnit;
+
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(value = 1, jvmArgs = {"-server", "-Xms512M", "-Xmx512M"})
+public class StringUtilsChompTest {
+// Different code paths with no chomp
+private static final String string1 = "";
+private static final String string2 = "a";
+private static final String string3 = "aa";
+
+// Single char chomp
+private static final String string4 = "\r";
+private static final String string5 = "\n";
+
+// Multi-char chomp
+private static final String string6 = "\r\n";
+private static final String string7 = "a\n";
+private static final String string8 = "a\r";
+private static final String string9 = "a\r\n";
+
+private static final String[] strings = buildStrings();
+
+private static String[] buildStrings() {
+String[] res = new String[128 * 128];
+for (int i = 0; i < 128; i++) {
+for (int j = 0; j < 128; j++) {
+StringBuilder stringBuilder = new StringBuilder();
+stringBuilder.append((char) i);
+stringBuilder.append((char) j);
+res[i * 128 + j] = stringBuilder.toString();
+}
+}
+return res;
+}
+
+@Benchmark
+public String test1_Empty_Old() {
+return chompOld(string1);
+}
+
+@Benchmark
+public String test1_Empty_New() {
+return chompNew(string1);
+}
+
+@Benchmark
+public String test2_No_Chomp_Old() {
+return chompOld(string2);
+}
+
+@Benchmark
+public String test2_No_Chomp_New() {
+return chompNew(string2);
+}
+
+@Benchmark
+public String test3_No_Chomp_Old() {
+return chompOld(string3);
+}
+
+@Benchmark
+public String test3_No_Chomp_New() {
+return chompNew(string3);
+}
+
+@Benchmark
+public String test4_R_Old() {
+return chompOld(string4);
+}
+
+@Benchmark
+public String test4_R_New() {
+return chompNew(string4);
+}
+
+@Benchmark
+public String test5_N_Old() {
+return chompOld(string5);
+}
+
+@Benchmark
+public String test5_N_New() {
+return chompNew(string5);
+}
+
+@Benchmark
+public String test6_R_N_Old() {
+return chompOld(string6);
+}
+
+@Benchmark
+public String test6_R_N_New() {
+return chompNew(string6);
+}
+
+@Benchmark
+public String test7_a_N_Old() {
+return chompOld(string7);
+}
+
+@Benchmark
+public String test7_a_N_New() {
+return chompNew(string7);
+}
+
+@Benchmark

[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468397&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468397
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 10/Aug/20 04:44
Start Date: 10/Aug/20 04:44
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r467685564



##
File path: src/main/java/org/apache/commons/lang3/StringUtils.java
##
@@ -697,27 +697,29 @@ public static String center(String str, final int size, 
String padStr) {
  * @return String without newline, {@code null} if null String input
  */
 public static String chomp(final String str) {
-if (isEmpty(str)) {
+final int length = length(str);
+
+if (length == 0) {
 return str;
 }
 
-if (str.length() == 1) {
+if (length == 1) {
 final char ch = str.charAt(0);
 if (ch == CharUtils.CR || ch == CharUtils.LF) {
 return EMPTY;
 }
 return str;
 }
 
-int lastIdx = str.length() - 1;
+int lastIdx = length - 1;
 final char last = str.charAt(lastIdx);
 
-if (last == CharUtils.LF) {
-if (str.charAt(lastIdx - 1) == CharUtils.CR) {
-lastIdx--;
+if (last != CharUtils.LF) {
+if (last != CharUtils.CR) {
+return str;
 }
-} else if (last != CharUtils.CR) {
-lastIdx++;
+} else if (str.charAt(lastIdx - 1) == CharUtils.CR) {
+--lastIdx;

Review comment:
   > Better to use lastIdx-- here - don't make unnecessary changes
   
   @sebbASF OK





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468397)
Time Spent: 5h  (was: 4h 50m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 5h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468339&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468339
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 09/Aug/20 16:49
Start Date: 09/Aug/20 16:49
Worklog Time Spent: 10m 
  Work Description: sebbASF commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r467604760



##
File path: src/main/java/org/apache/commons/lang3/StringUtils.java
##
@@ -697,27 +697,29 @@ public static String center(String str, final int size, 
String padStr) {
  * @return String without newline, {@code null} if null String input
  */
 public static String chomp(final String str) {
-if (isEmpty(str)) {
+final int length = length(str);
+
+if (length == 0) {
 return str;
 }
 
-if (str.length() == 1) {
+if (length == 1) {
 final char ch = str.charAt(0);
 if (ch == CharUtils.CR || ch == CharUtils.LF) {
 return EMPTY;
 }
 return str;
 }
 
-int lastIdx = str.length() - 1;
+int lastIdx = length - 1;
 final char last = str.charAt(lastIdx);
 
-if (last == CharUtils.LF) {
-if (str.charAt(lastIdx - 1) == CharUtils.CR) {
-lastIdx--;
+if (last != CharUtils.LF) {
+if (last != CharUtils.CR) {
+return str;
 }
-} else if (last != CharUtils.CR) {
-lastIdx++;
+} else if (str.charAt(lastIdx - 1) == CharUtils.CR) {
+--lastIdx;

Review comment:
   Better to use lastIdx-- here - don't make unnecessary changes





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468339)
Time Spent: 4h 50m  (was: 4h 40m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 4h 50m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468338&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468338
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 09/Aug/20 16:47
Start Date: 09/Aug/20 16:47
Worklog Time Spent: 10m 
  Work Description: sebbASF commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r467604598



##
File path: src/main/java/org/apache/commons/lang3/StringUtils.java
##
@@ -697,27 +697,29 @@ public static String center(String str, final int size, 
String padStr) {
  * @return String without newline, {@code null} if null String input
  */
 public static String chomp(final String str) {
-if (isEmpty(str)) {
+final int length = length(str);
+
+if (length == 0) {
 return str;
 }
 
-if (str.length() == 1) {
+if (length == 1) {
 final char ch = str.charAt(0);
 if (ch == CharUtils.CR || ch == CharUtils.LF) {
 return EMPTY;
 }
 return str;
 }
 
-int lastIdx = str.length() - 1;
+int lastIdx = length - 1;
 final char last = str.charAt(lastIdx);
 
-if (last == CharUtils.LF) {
-if (str.charAt(lastIdx - 1) == CharUtils.CR) {
-lastIdx--;
+if (last != CharUtils.LF) {
+if (last != CharUtils.CR) {

Review comment:
   The changes would be clearer if the original condition had been kept.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468338)
Time Spent: 4h 40m  (was: 4.5h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 4h 40m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-07 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468187&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468187
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 08/Aug/20 04:49
Start Date: 08/Aug/20 04:49
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-650908222


   
   [![Coverage 
Status](https://coveralls.io/builds/32620597/badge)](https://coveralls.io/builds/32620597)
   
   Coverage decreased (-0.0003%) to 94.665% when pulling 
**302c0d64261b210e22852e2b726fdfefce0e8a38 on XenoAmess:refine_chomp** into 
**cf0bc2b5dbb08ee1f5c0c8d54df307e23345544d on apache:master**.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468187)
Time Spent: 4.5h  (was: 4h 20m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 4.5h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-08-07 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=468186&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468186
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 08/Aug/20 04:28
Start Date: 08/Aug/20 04:28
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-670822156


   @aherbert 
   Hi.
   I changed the jmh codes according to your suggestions, and re-run 
performance test.
   full test at: https://pastebin.ubuntu.com/p/cqNKS35zSP/
   in short:
   ```
   Benchmark  (data)  (name)  Mode  Cnt 
 Score   Error  Units
   StringUtilsChompTest.singleStringNULL old  avgt5 
 2.737 ?0.166  ns/op
   
   StringUtilsChompTest.singleStringNULL new  avgt5 
 2.789 ?0.213  ns/op
   
   StringUtilsChompTest.singleString   CHAR0 old  avgt5 
 3.227 ?0.459  ns/op
   
   StringUtilsChompTest.singleString   CHAR0 new  avgt5 
 3.168 ?0.233  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_CR old  avgt5 
 3.706 ?0.035  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_CR new  avgt5 
 3.674 ?0.480  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_LF old  avgt5 
 3.656 ?0.410  ns/op
   
   StringUtilsChompTest.singleStringCHAR0_LF new  avgt5 
 3.682 ?0.525  ns/op
   
   StringUtilsChompTest.singleString CHAR0_CR_LF old  avgt5 
 9.538 ?1.558  ns/op
   
   StringUtilsChompTest.singleString CHAR0_CR_LF new  avgt5 
 9.359 ?0.499  ns/op
   
   StringUtilsChompTest.singleString   CHAR1 old  avgt5 
 3.880 ?0.531  ns/op
   
   StringUtilsChompTest.singleString   CHAR1 new  avgt5 
 3.803 ?0.451  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_CR old  avgt5 
17.378 ?2.431  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_CR new  avgt5 
21.752 ?   23.793  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_LF old  avgt5 
19.025 ?4.690  ns/op
   
   StringUtilsChompTest.singleStringCHAR1_LF new  avgt5 
18.087 ?2.450  ns/op
   
   StringUtilsChompTest.singleString CHAR1_CR_LF old  avgt5 
17.940 ?1.500  ns/op
   
   StringUtilsChompTest.singleString CHAR1_CR_LF new  avgt5 
18.130 ?1.195  ns/op
   
   StringUtilsChompTest.singleString   CHAR2 old  avgt5 
 4.216 ?1.192  ns/op
   
   StringUtilsChompTest.singleString   CHAR2 new  avgt5 
 4.341 ?0.310  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_CR old  avgt5 
17.308 ?2.704  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_CR new  avgt5 
18.087 ?2.312  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_LF old  avgt5 
18.527 ?2.699  ns/op
   
   StringUtilsChompTest.singleStringCHAR2_LF new  avgt5 
18.200 ?1.919  ns/op
   
   StringUtilsChompTest.singleString CHAR2_CR_LF old  avgt5 
17.692 ?0.991  ns/op
   
   StringUtilsChompTest.singleString CHAR2_CR_LF new  avgt5 
18.285 ?2.505  ns/op
   
   StringUtilsChompTest.test_Random_Strings_New  N/A N/A  avgt5 
 66999.815 ?10053.205  ns/op
   
   StringUtilsChompTest.test_Random_Strings_Old  N/A N/A  avgt5 
 76290.287 ?15986.436  ns/op
   ```
   
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 468186)
Time Spent: 4h 20m  (was: 4h 10m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 4h 20m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=464198&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-464198
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 29/Jul/20 17:47
Start Date: 29/Jul/20 17:47
Worklog Time Spent: 10m 
  Work Description: aherbert commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r462184805



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.infra.Blackhole;
+
+import java.util.concurrent.TimeUnit;
+
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(value = 1, jvmArgs = {"-server", "-Xms512M", "-Xmx512M"})
+public class StringUtilsChompTest {
+// Different code paths with no chomp
+private static final String string1 = "";
+private static final String string2 = "a";
+private static final String string3 = "aa";
+
+// Single char chomp
+private static final String string4 = "\r";
+private static final String string5 = "\n";
+
+// Multi-char chomp
+private static final String string6 = "\r\n";
+private static final String string7 = "a\n";
+private static final String string8 = "a\r";
+private static final String string9 = "a\r\n";
+
+private static final String[] strings = buildStrings();
+
+private static String[] buildStrings() {
+String[] res = new String[128 * 128];
+for (int i = 0; i < 128; i++) {
+for (int j = 0; j < 128; j++) {
+StringBuilder stringBuilder = new StringBuilder();
+stringBuilder.append((char) i);
+stringBuilder.append((char) j);
+res[i * 128 + j] = stringBuilder.toString();
+}
+}
+return res;
+}
+
+@Benchmark
+public String test1_Empty_Old() {
+return chompOld(string1);
+}
+
+@Benchmark
+public String test1_Empty_New() {
+return chompNew(string1);
+}
+
+@Benchmark
+public String test2_No_Chomp_Old() {
+return chompOld(string2);
+}
+
+@Benchmark
+public String test2_No_Chomp_New() {
+return chompNew(string2);
+}
+
+@Benchmark
+public String test3_No_Chomp_Old() {
+return chompOld(string3);
+}
+
+@Benchmark
+public String test3_No_Chomp_New() {
+return chompNew(string3);
+}
+
+@Benchmark
+public String test4_R_Old() {
+return chompOld(string4);
+}
+
+@Benchmark
+public String test4_R_New() {
+return chompNew(string4);
+}
+
+@Benchmark
+public String test5_N_Old() {
+return chompOld(string5);
+}
+
+@Benchmark
+public String test5_N_New() {
+return chompNew(string5);
+}
+
+@Benchmark
+public String test6_R_N_Old() {
+return chompOld(string6);
+}
+
+@Benchmark
+public String test6_R_N_New() {
+return chompNew(string6);
+}
+
+@Benchmark
+public String test7_a_N_Old() {
+return chompOld(string7);
+}
+
+@Benchmark
+public String test7_a_N_New() {
+return chompNew(string7);
+}
+
+@Benchmark

[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=464078&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-464078
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 29/Jul/20 07:59
Start Date: 29/Jul/20 07:59
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-650908222







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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 464078)
Time Spent: 4h  (was: 3h 50m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 4h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463903&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463903
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 29/Jul/20 07:43
Start Date: 29/Jul/20 07:43
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-664969226







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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463903)
Time Spent: 3h 50m  (was: 3h 40m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 3h 50m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463781&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463781
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 29/Jul/20 07:32
Start Date: 29/Jul/20 07:32
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r461489274



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+/**
+ * Test to show whether using BitSet for removeAll() methods is faster than 
using HashSet.
+ */
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+public class StringUtilsChompTest {
+
+private static final String string1 = "\r";
+private static final String string2 = buildString2();
+
+private static String buildString2() {
+StringBuilder stringBuilder = new StringBuilder();
+for (int i = 0; i < 10; i++) {
+stringBuilder.append('0');
+stringBuilder.append('\r');
+stringBuilder.append('0');
+stringBuilder.append('\n');
+stringBuilder.append('0');
+stringBuilder.append('\r');
+stringBuilder.append('\n');
+}
+return stringBuilder.toString();
+}
+
+@Benchmark
+public void test1Old() {
+chompOld(string1);

Review comment:
   @sebbASF @thc202 thanks. remaked the jmh test.

##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+/**
+ * Test to show whether using BitSet for removeAll() methods is faster than 
using HashSet.
+ */
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+public class StringUtilsChompTest {
+
+private static final String string1 = "\r";
+private static final String string2 = buildString2();
+
+private static String buildString2() {
+StringBuilder stringBuilder = new StringBuilder();
+for (int i = 0; i < 10; i++) {
+stri

[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463738&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463738
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 29/Jul/20 07:27
Start Date: 29/Jul/20 07:27
Worklog Time Spent: 10m 
  Work Description: XenoAmess removed a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-664013772







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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463738)
Time Spent: 3h 20m  (was: 3h 10m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 3h 20m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463818&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463818
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 29/Jul/20 07:35
Start Date: 29/Jul/20 07:35
Worklog Time Spent: 10m 
  Work Description: aherbert commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r461511023



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.infra.Blackhole;
+
+import java.util.concurrent.TimeUnit;
+
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+public class StringUtilsChompTest {
+private static final String string1 = "\r";
+private static final String string2 = "a";
+private static final String string3 = "aa";
+private static final String string4 = "aa\r";
+private static final String string5 = "aa\n";
+private static final String string6 = buildString6();

Review comment:
   string6 will be the same as string5

##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.infra.Blackhole;
+
+import java.util.concurrent.TimeUnit;
+
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+public class StringUtilsChompTest {
+private static final String string1 = "\r";
+private static final String string2 = "a";
+private static final String string3 = "aa";
+private static final String string4 = "aa\r";
+private static final String string5 = "aa\n";
+private static final String string6 = buildString6();
+private static final String[] strings = buildStrings();

Review comment:
   The majority of these strings will not end with either CR (char 13) or 
LF (char 10). So you will not be chomping anything most of the time. I do not 
think that is what you want to test the performance of.

##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under

[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463605&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463605
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 29/Jul/20 07:14
Start Date: 29/Jul/20 07:14
Worklog Time Spent: 10m 
  Work Description: XenoAmess edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-664970394







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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463605)
Time Spent: 3h 10m  (was: 3h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463445&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463445
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 27/Jul/20 01:41
Start Date: 27/Jul/20 01:41
Worklog Time Spent: 10m 
  Work Description: thc202 commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r460605904



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+/**
+ * Test to show whether using BitSet for removeAll() methods is faster than 
using HashSet.
+ */
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+public class StringUtilsChompTest {
+
+private static final String string1 = "\r";
+private static final String string2 = buildString2();
+
+private static String buildString2() {
+StringBuilder stringBuilder = new StringBuilder();
+for (int i = 0; i < 10; i++) {
+stringBuilder.append('0');
+stringBuilder.append('\r');
+stringBuilder.append('0');
+stringBuilder.append('\n');
+stringBuilder.append('0');
+stringBuilder.append('\r');
+stringBuilder.append('\n');
+}
+return stringBuilder.toString();
+}
+
+@Benchmark
+public void test1Old() {
+chompOld(string1);

Review comment:
   JMH samples talk about this, e.g.: 
https://hg.openjdk.java.net/code-tools/jmh/file/4a420afe8a9e/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_08_DeadCode.java
   
https://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463445)
Time Spent: 3h  (was: 2h 50m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 3h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463436&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463436
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 23:45
Start Date: 26/Jul/20 23:45
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-650908222


   
   [![Coverage 
Status](https://coveralls.io/builds/32331050/badge)](https://coveralls.io/builds/32331050)
   
   Coverage increased (+0.0003%) to 94.666% when pulling 
**04dff56b617cf6b02ac0859c3cd6e749764e2182 on XenoAmess:refine_chomp** into 
**cf0bc2b5dbb08ee1f5c0c8d54df307e23345544d on apache:master**.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463436)
Time Spent: 2h 50m  (was: 2h 40m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463435&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463435
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 23:40
Start Date: 26/Jul/20 23:40
Worklog Time Spent: 10m 
  Work Description: sebbASF commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-664055647


   The JMH results are very long and obscure the thread of the PR.
   
   Is it possible to post just the summary inline, with a link to the full 
results in an attachment?
   That would make it much easier to follow the PR.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463435)
Time Spent: 2h 40m  (was: 2.5h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463434&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463434
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 23:37
Start Date: 26/Jul/20 23:37
Worklog Time Spent: 10m 
  Work Description: sebbASF commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r460587706



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+/**
+ * Test to show whether using BitSet for removeAll() methods is faster than 
using HashSet.
+ */
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+public class StringUtilsChompTest {
+
+private static final String string1 = "\r";
+private static final String string2 = buildString2();
+
+private static String buildString2() {
+StringBuilder stringBuilder = new StringBuilder();
+for (int i = 0; i < 10; i++) {
+stringBuilder.append('0');
+stringBuilder.append('\r');
+stringBuilder.append('0');
+stringBuilder.append('\n');
+stringBuilder.append('0');
+stringBuilder.append('\r');
+stringBuilder.append('\n');
+}
+return stringBuilder.toString();
+}
+
+@Benchmark
+public void test1Old() {
+chompOld(string1);

Review comment:
   The JVM is free to discard code that does nothing useful.
   
https://stackoverflow.com/questions/4871550/how-can-i-be-sure-that-the-compiler-doesnt-optimize-away-my-performance-test





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463434)
Time Spent: 2.5h  (was: 2h 20m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463433&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463433
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 23:29
Start Date: 26/Jul/20 23:29
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r460586849



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+/**
+ * Test to show whether using BitSet for removeAll() methods is faster than 
using HashSet.
+ */
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+public class StringUtilsChompTest {
+
+private static final String string1 = "\r";
+private static final String string2 = buildString2();
+
+private static String buildString2() {
+StringBuilder stringBuilder = new StringBuilder();
+for (int i = 0; i < 10; i++) {
+stringBuilder.append('0');
+stringBuilder.append('\r');
+stringBuilder.append('0');
+stringBuilder.append('\n');
+stringBuilder.append('0');
+stringBuilder.append('\r');
+stringBuilder.append('\n');
+}
+return stringBuilder.toString();
+}
+
+@Benchmark
+public void test1Old() {
+chompOld(string1);

Review comment:
   @aherbert 
   > Otherwise there is nothing to prevent the JVM from not running your chomp 
methods as the result is discarded. 
   Is there some material/document about this?
   I ask because seems I never observed this kind of thing happened...
   





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463433)
Time Spent: 2h 20m  (was: 2h 10m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463432&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463432
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 23:26
Start Date: 26/Jul/20 23:26
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r460586417



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+/**
+ * Test to show whether using BitSet for removeAll() methods is faster than 
using HashSet.

Review comment:
   @aherbert 
   > This is not what the benchmark is doing.
   
   Ah yes, this class is copied from HashSetvBitSetTest then modified.
   But forgot to delete this doc by mistake :)
   will delete it now.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463432)
Time Spent: 2h 10m  (was: 2h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463430&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463430
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 23:25
Start Date: 26/Jul/20 23:25
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r460586417



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+/**
+ * Test to show whether using BitSet for removeAll() methods is faster than 
using HashSet.

Review comment:
   > This is not what the benchmark is doing.
   
   Ah yes, this class is copied from HashSetvBitSetTest then modified.
   But forgot to delete this doc by mistake :)





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463430)
Time Spent: 1h 50m  (was: 1h 40m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463431&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463431
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 23:25
Start Date: 26/Jul/20 23:25
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r460586417



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+/**
+ * Test to show whether using BitSet for removeAll() methods is faster than 
using HashSet.

Review comment:
   > This is not what the benchmark is doing.
   
   Ah yes, this class is copied from HashSetvBitSetTest then modified.
   But forgot to delete this doc by mistake :)
   will delete it now.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463431)
Time Spent: 2h  (was: 1h 50m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 2h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463428&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463428
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 23:13
Start Date: 26/Jul/20 23:13
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-650908222


   
   [![Coverage 
Status](https://coveralls.io/builds/32330862/badge)](https://coveralls.io/builds/32330862)
   
   Coverage increased (+0.0003%) to 94.666% when pulling 
**28f0fa7336879e6da4e3f85e4ab8feec6dc9d55b on XenoAmess:refine_chomp** into 
**8577e0c3295ae4d933c5dff22bd034487adcd23b on apache:master**.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463428)
Time Spent: 1h 40m  (was: 1.5h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463424&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463424
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 23:00
Start Date: 26/Jul/20 23:00
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-664051325


   yes, it is not a very significant refine.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463424)
Time Spent: 1.5h  (was: 1h 20m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463423&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463423
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 22:59
Start Date: 26/Jul/20 22:59
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-664051177


   jmh
   ```
   [INFO] --- exec-maven-plugin:1.6.0:exec (benchmark) @ commons-lang3 ---
   WARNING: An illegal reflective access operation has occurred
   WARNING: Illegal reflective access by org.openjdk.jmh.util.Utils 
(file:/C:/Users/xenoa/.m2/repository/org/openjdk/jmh/jmh-core/
   1.21/jmh-core-1.21.jar) to field java.io.PrintStream.charOut
   WARNING: Please consider reporting this to the maintainers of 
org.openjdk.jmh.util.Utils
   WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
   WARNING: All illegal access operations will be denied in a future release
   # JMH version: 1.21
   # VM version: JDK 13.0.2, OpenJDK 64-Bit Server VM, 13.0.2+8
   # VM invoker: C:\jdk-13.0.2+8\bin\java.exe
   # VM options: 
   # Warmup: 5 iterations, 10 s each
   # Measurement: 5 iterations, 10 s each
   # Timeout: 10 min per iteration
   # Threads: 1 thread, will synchronize iterations
   # Benchmark mode: Average time, time/op
   # Benchmark: org.apache.commons.lang3.StringUtilsChompTest.test1New
   
   # Run progress: 0.00% complete, ETA 01:23:20
   # Fork: 1 of 5
   # Warmup Iteration   1: 0.489 ns/op
   # Warmup Iteration   2: 0.429 ns/op
   # Warmup Iteration   3: 0.693 ns/op
   # Warmup Iteration   4: 0.609 ns/op
   # Warmup Iteration   5: 0.553 ns/op
   Iteration   1: 0.535 ns/op
   Iteration   2: 0.543 ns/op
   Iteration   3: 0.540 ns/op
   Iteration   4: 0.540 ns/op
   Iteration   5: 0.544 ns/op
   
   # Run progress: 2.00% complete, ETA 01:22:05
   # Fork: 2 of 5
   # Warmup Iteration   1: 0.412 ns/op
   # Warmup Iteration   2: 0.404 ns/op
   # Warmup Iteration   3: 0.548 ns/op
   # Warmup Iteration   4: 0.530 ns/op
   # Warmup Iteration   5: 0.536 ns/op
   Iteration   1: 0.539 ns/op
   Iteration   2: 0.556 ns/op
   Iteration   3: 0.540 ns/op
   Iteration   4: 0.545 ns/op
   Iteration   5: 0.536 ns/op
   
   # Run progress: 4.00% complete, ETA 01:20:21
   # Fork: 3 of 5
   # Warmup Iteration   1: 0.408 ns/op
   # Warmup Iteration   2: 0.403 ns/op
   # Warmup Iteration   3: 0.535 ns/op
   # Warmup Iteration   4: 0.543 ns/op
   # Warmup Iteration   5: 0.539 ns/op
   Iteration   1: 0.547 ns/op
   Iteration   2: 0.544 ns/op
   Iteration   3: 0.544 ns/op
   Iteration   4: 0.536 ns/op
   Iteration   5: 0.549 ns/op
   
   # Run progress: 6.00% complete, ETA 01:18:40
   # Fork: 4 of 5
   # Warmup Iteration   1: 0.427 ns/op
   # Warmup Iteration   2: 0.425 ns/op
   # Warmup Iteration   3: 0.546 ns/op
   # Warmup Iteration   4: 0.533 ns/op
   # Warmup Iteration   5: 0.542 ns/op
   Iteration   1: 0.533 ns/op
   Iteration   2: 0.529 ns/op
   Iteration   3: 0.537 ns/op
   Iteration   4: 0.531 ns/op
   Iteration   5: 0.533 ns/op
   
   # Run progress: 8.00% complete, ETA 01:16:59
   # Fork: 5 of 5
   # Warmup Iteration   1: 0.400 ns/op
   # Warmup Iteration   2: 0.400 ns/op
   # Warmup Iteration   3: 0.534 ns/op
   # Warmup Iteration   4: 0.536 ns/op
   # Warmup Iteration   5: 0.536 ns/op
   Iteration   1: 0.534 ns/op
   Iteration   2: 0.534 ns/op
   Iteration   3: 0.536 ns/op
   Iteration   4: 0.541 ns/op
   Iteration   5: 0.540 ns/op
   
   
   Result "org.apache.commons.lang3.StringUtilsChompTest.test1New":
 0.539 ?99.9%) 0.005 ns/op [Average]
   
 (min, avg, max) = (0.529, 0.539, 0.556), stdev = 0.006
 CI (99.9%): [0.535, 0.544] (assumes normal distribution)
   
   
   # JMH version: 1.21
   # VM version: JDK 13.0.2, OpenJDK 64-Bit Server VM, 13.0.2+8
   # VM invoker: C:\jdk-13.0.2+8\bin\java.exe
   # VM options: 
   # Warmup: 5 iterations, 10 s each
   # Measurement: 5 iterations, 10 s each
   # Timeout: 10 min per iteration
   # Threads: 1 thread, will synchronize iterations
   # Benchmark mode: Average time, time/op
   # Benchmark: org.apache.commons.lang3.StringUtilsChompTest.test1Old
   
   # Run progress: 10.00% complete, ETA 01:15:19
   # Fork: 1 of 5
   # Warmup Iteration   1: 0.408 ns/op
   # Warmup Iteration   2: 0.406 ns/op
   # Warmup Iteration   3: 0.540 ns/op
   # Warmup Iteration   4: 0.530 ns/op
   # Warmup Iteration   5: 0.539 ns/op
   Iteration   1: 0.544 ns/op
   Iteration   2: 0.551 ns/op
   Iteration   3: 0.536 ns/op
   Iteration   4: 0.549 ns/op
   Iteration   5: 0.542 ns/op
   
   # Run progress: 12.00% complete, ETA 01:13:39
   # Fork: 2 of 5
   # Warmup Iteration   1: 0.400 ns/op
   # Warmup Iteration   2: 0.411 ns/op
   # Warmup Iteration   3: 0.569 ns/op
   # Warmup Iteration   4: 0.587 ns/

[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463421&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463421
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 22:58
Start Date: 26/Jul/20 22:58
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-664051092


   I add more things to the test.
   see the new commit and the result.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463421)
Time Spent: 1h 10m  (was: 1h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463404&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463404
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 20:36
Start Date: 26/Jul/20 20:36
Worklog Time Spent: 10m 
  Work Description: aherbert commented on a change in pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#discussion_r460568874



##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+/**
+ * Test to show whether using BitSet for removeAll() methods is faster than 
using HashSet.

Review comment:
   This is not what the benchmark is doing.

##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.lang3;
+
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.apache.commons.lang3.StringUtils.length;
+
+/**
+ * Test to show whether using BitSet for removeAll() methods is faster than 
using HashSet.
+ */
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+public class StringUtilsChompTest {
+
+private static final String string1 = "\r";
+private static final String string2 = buildString2();
+
+private static String buildString2() {
+StringBuilder stringBuilder = new StringBuilder();
+for (int i = 0; i < 10; i++) {
+stringBuilder.append('0');
+stringBuilder.append('\r');
+stringBuilder.append('0');
+stringBuilder.append('\n');
+stringBuilder.append('0');
+stringBuilder.append('\r');
+stringBuilder.append('\n');
+}
+return stringBuilder.toString();
+}
+
+@Benchmark
+public void test1Old() {
+chompOld(string1);

Review comment:
   You should return String from all your benchmark methods. Otherwise 
there is nothing to prevent the JVM from not running your chomp methods as the 
result is discarded. If you return the chomped String then the JMH framework 
will consume it thus forcing the JVM to run the method.

##
File path: src/test/java/org/apache/commons/lang3/StringUtilsChompTest.java
##
@@ -0,0 +1,133 

[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463374&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463374
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 17:13
Start Date: 26/Jul/20 17:13
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-664015324


   > Does not seem like a huge gain.
   
   Yes, it isn't.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463374)
Time Spent: 50m  (was: 40m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463373&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463373
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 17:12
Start Date: 26/Jul/20 17:12
Worklog Time Spent: 10m 
  Work Description: sebbASF commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-664015190


   If I understand the benchmark correctly, the New method is approx 3% slower 
for Test1 and about 2% faster for Test2.
   Does not seem like a huge gain.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463373)
Time Spent: 40m  (was: 0.5h)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463372&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463372
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 17:09
Start Date: 26/Jul/20 17:09
Worklog Time Spent: 10m 
  Work Description: coveralls edited a comment on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-650908222


   
   [![Coverage 
Status](https://coveralls.io/builds/32328557/badge)](https://coveralls.io/builds/32328557)
   
   Coverage increased (+0.0003%) to 94.666% when pulling 
**cedce8b716f554eef5a088536869253e8f572047 on XenoAmess:refine_chomp** into 
**8577e0c3295ae4d933c5dff22bd034487adcd23b on apache:master**.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463372)
Time Spent: 0.5h  (was: 20m)

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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


[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-07-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=463370&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463370
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 26/Jul/20 17:00
Start Date: 26/Jul/20 17:00
Worklog Time Spent: 10m 
  Work Description: XenoAmess commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-664013772


   jmh
   ```
   [INFO] --- exec-maven-plugin:1.6.0:exec (benchmark) @ commons-lang3 ---
   WARNING: An illegal reflective access operation has occurred
   WARNING: Illegal reflective access by org.openjdk.jmh.util.Utils 
(file:/C:/Users/xenoa/.m2/repository/org/openjdk/jmh/jmh-core/
   1.21/jmh-core-1.21.jar) to field java.io.PrintStream.charOut
   WARNING: Please consider reporting this to the maintainers of 
org.openjdk.jmh.util.Utils
   WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
   WARNING: All illegal access operations will be denied in a future release
   # JMH version: 1.21
   # VM version: JDK 13.0.2, OpenJDK 64-Bit Server VM, 13.0.2+8
   # VM invoker: C:\jdk-13.0.2+8\bin\java.exe
   # VM options: 
   # Warmup: 5 iterations, 10 s each
   # Measurement: 5 iterations, 10 s each
   # Timeout: 10 min per iteration
   # Threads: 1 thread, will synchronize iterations
   # Benchmark mode: Average time, time/op
   # Benchmark: org.apache.commons.lang3.StringUtilsChompTest.test1New
   
   # Run progress: 0.00% complete, ETA 00:33:20
   # Fork: 1 of 5
   # Warmup Iteration   1: 0.455 ns/op
   # Warmup Iteration   2: 0.426 ns/op
   # Warmup Iteration   3: 0.591 ns/op
   # Warmup Iteration   4: 0.568 ns/op
   # Warmup Iteration   5: 0.627 ns/op
   Iteration   1: 0.629 ns/op
   Iteration   2: 0.607 ns/op
   Iteration   3: 0.574 ns/op
   Iteration   4: 0.575 ns/op
   Iteration   5: 0.562 ns/op
   
   # Run progress: 5.00% complete, ETA 00:31:49
   # Fork: 2 of 5
   # Warmup Iteration   1: 0.413 ns/op
   # Warmup Iteration   2: 0.417 ns/op
   # Warmup Iteration   3: 0.563 ns/op
   # Warmup Iteration   4: 0.552 ns/op
   # Warmup Iteration   5: 0.565 ns/op
   Iteration   1: 0.558 ns/op
   Iteration   2: 0.562 ns/op
   Iteration   3: 0.559 ns/op
   Iteration   4: 0.550 ns/op
   Iteration   5: 0.555 ns/op
   
   # Run progress: 10.00% complete, ETA 00:30:09
   # Fork: 3 of 5
   # Warmup Iteration   1: 0.414 ns/op
   # Warmup Iteration   2: 0.409 ns/op
   # Warmup Iteration   3: 0.561 ns/op
   # Warmup Iteration   4: 0.554 ns/op
   # Warmup Iteration   5: 0.555 ns/op
   Iteration   1: 0.553 ns/op
   Iteration   2: 0.558 ns/op
   Iteration   3: 0.557 ns/op
   Iteration   4: 0.560 ns/op
   Iteration   5: 0.556 ns/op
   
   # Run progress: 15.00% complete, ETA 00:28:28
   # Fork: 4 of 5
   # Warmup Iteration   1: 0.415 ns/op
   # Warmup Iteration   2: 0.418 ns/op
   # Warmup Iteration   3: 0.574 ns/op
   # Warmup Iteration   4: 0.581 ns/op
   # Warmup Iteration   5: 0.581 ns/op
   Iteration   1: 0.674 ns/op
   Iteration   2: 0.791 ns/op
   Iteration   3: 0.630 ns/op
   Iteration   4: 0.630 ns/op
   Iteration   5: 0.575 ns/op
   
   # Run progress: 20.00% complete, ETA 00:26:47
   # Fork: 5 of 5
   # Warmup Iteration   1: 0.416 ns/op
   # Warmup Iteration   2: 0.415 ns/op
   # Warmup Iteration   3: 0.555 ns/op
   # Warmup Iteration   4: 0.567 ns/op
   # Warmup Iteration   5: 0.566 ns/op
   Iteration   1: 0.557 ns/op
   Iteration   2: 0.552 ns/op
   Iteration   3: 0.557 ns/op
   Iteration   4: 0.571 ns/op
   Iteration   5: 0.559 ns/op
   
   
   Result "org.apache.commons.lang3.StringUtilsChompTest.test1New":
 0.584 ?99.9%) 0.040 ns/op [Average]
   
 (min, avg, max) = (0.550, 0.584, 0.791), stdev = 0.054
 CI (99.9%): [0.544, 0.625] (assumes normal distribution)
   
   
   # JMH version: 1.21
   # VM version: JDK 13.0.2, OpenJDK 64-Bit Server VM, 13.0.2+8
   # VM invoker: C:\jdk-13.0.2+8\bin\java.exe
   # VM options: 
   # Warmup: 5 iterations, 10 s each
   # Measurement: 5 iterations, 10 s each
   # Timeout: 10 min per iteration
   # Threads: 1 thread, will synchronize iterations
   # Benchmark mode: Average time, time/op
   # Benchmark: org.apache.commons.lang3.StringUtilsChompTest.test1Old
   
   # Run progress: 25.00% complete, ETA 00:25:07
   # Fork: 1 of 5
   # Warmup Iteration   1: 0.416 ns/op
   # Warmup Iteration   2: 0.422 ns/op
   # Warmup Iteration   3: 0.559 ns/op
   # Warmup Iteration   4: 0.557 ns/op
   # Warmup Iteration   5: 0.560 ns/op
   Iteration   1: 0.561 ns/op
   Iteration   2: 0.568 ns/op
   Iteration   3: 0.555 ns/op
   Iteration   4: 0.564 ns/op
   Iteration   5: 0.567 ns/op
   
   # Run progress: 30.00% complete, ETA 00:23:26
   # Fork: 2 of 5
   # Warmup Iteration   1: 0.432 ns/op
   # Warmup Iteration   2: 0.415 ns/op
   # Warmup Iteration   3: 0.580 ns/op
   # Warmup Iteration   4: 0.564 

[jira] [Work logged] (LANG-1576) refine StringUtils.chomp

2020-06-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1576?focusedWorklogId=452174&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-452174
 ]

ASF GitHub Bot logged work on LANG-1576:


Author: ASF GitHub Bot
Created on: 29/Jun/20 05:10
Start Date: 29/Jun/20 05:10
Worklog Time Spent: 10m 
  Work Description: coveralls commented on pull request #565:
URL: https://github.com/apache/commons-lang/pull/565#issuecomment-650908222


   
   [![Coverage 
Status](https://coveralls.io/builds/31739797/badge)](https://coveralls.io/builds/31739797)
   
   Coverage increased (+0.0003%) to 94.679% when pulling 
**3a5af886d6010f552ffb19681543803337030ccd on XenoAmess:refine_chomp** into 
**da0f6a8051cc60d1bebe703b4e390ce3035497db on apache:master**.
   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 452174)
Remaining Estimate: 0h
Time Spent: 10m

> refine StringUtils.chomp
> 
>
> Key: LANG-1576
> URL: https://issues.apache.org/jira/browse/LANG-1576
> Project: Commons Lang
>  Issue Type: Sub-task
>Reporter: Jin Xu
>Priority: Minor
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/commons-lang/pull/565]



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