Skip to content

Conversation

XenoAmess
Copy link
Contributor

as title.

@XenoAmess XenoAmess changed the title refine StringUtils.strip [LANG-1587] refine StringUtils.strip Jun 29, 2020
@coveralls
Copy link

coveralls commented Jun 29, 2020

Coverage Status

Coverage increased (+0.006%) to 94.963% when pulling 079df6c on xenoamess-fork:refine_strip into e233ab6 on apache:master.

@XenoAmess XenoAmess force-pushed the refine_strip branch 2 times, most recently from 5d26f2c to 98df98e Compare July 28, 2020 15:24
@XenoAmess
Copy link
Contributor Author

XenoAmess commented Jul 28, 2020

full performance test at https://pastebin.ubuntu.com/p/xpZVrHpDXG/
In short,

StringUtilsStripTest.test00New        avgt    5         2.308 ?       0.046  ns/op

StringUtilsStripTest.test00Old        avgt    5         2.307 ?       0.072  ns/op

StringUtilsStripTest.test01New        avgt    5         2.546 ?       0.075  ns/op

StringUtilsStripTest.test01Old        avgt    5         2.543 ?       0.105  ns/op

StringUtilsStripTest.test10New        avgt    5        28.352 ?       1.662  ns/op

StringUtilsStripTest.test10Old        avgt    5         6.593 ?       0.467  ns/op

StringUtilsStripTest.test11New        avgt    5        17.817 ?       1.338  ns/op

StringUtilsStripTest.test11Old        avgt    5        17.940 ?       1.311  ns/op

StringUtilsStripTest.test20New        avgt    5        29.318 ?       1.701  ns/op

StringUtilsStripTest.test20Old        avgt    5         6.280 ?       0.710  ns/op

StringUtilsStripTest.test21New        avgt    5        22.556 ?       3.598  ns/op

StringUtilsStripTest.test21Old        avgt    5        22.761 ?       3.757  ns/op

StringUtilsStripTest.test30New        avgt    5        36.088 ?       7.050  ns/op

StringUtilsStripTest.test30Old        avgt    5        43.252 ?       4.774  ns/op

StringUtilsStripTest.test31New        avgt    5        23.776 ?       0.927  ns/op

StringUtilsStripTest.test31Old        avgt    5        38.795 ?       2.763  ns/op

StringUtilsStripTest.test40New        avgt    5        16.315 ?       0.904  ns/op

StringUtilsStripTest.test40Old        avgt    5        10.407 ?       0.766  ns/op

StringUtilsStripTest.test41New        avgt    5        11.135 ?       0.513  ns/op

StringUtilsStripTest.test41Old        avgt    5        12.398 ?       1.291  ns/op

StringUtilsStripTest.test50New        avgt    5        21.440 ?       5.537  ns/op

StringUtilsStripTest.test50Old        avgt    5        15.255 ?       2.052  ns/op

StringUtilsStripTest.test51New        avgt    5        16.892 ?       3.979  ns/op

StringUtilsStripTest.test51Old        avgt    5        16.976 ?       3.205  ns/op

StringUtilsStripTest.test60New        avgt    5        17.609 ?       1.803  ns/op

StringUtilsStripTest.test60Old        avgt    5        34.192 ?       3.271  ns/op

StringUtilsStripTest.test61New        avgt    5        14.651 ?       1.143  ns/op

StringUtilsStripTest.test61Old        avgt    5        30.726 ?       7.021  ns/op

StringUtilsStripTest.testStrings0New  avgt    5  25788975.165 ?16074023.892  ns/op

StringUtilsStripTest.testStrings0Old  avgt    5  29418606.310 ? 7928783.178  ns/op

StringUtilsStripTest.testStrings1New  avgt    5  19118531.531 ?  429275.123  ns/op

StringUtilsStripTest.testStrings1Old  avgt    5  25585907.686 ? 2117790.922  ns/op

indicates:

  1. when [only one side of that String contains whitespace] && [stripChars!=null] , the new function is slower.
  2. in other situations the new function runs faster.
  3. the new function runs faster in average (of all String in length 3)

So I really have no idea if we should merge this pr.

@XenoAmess
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants