OpenJDK 11: Add String.repeat()
This CL adds java.lang.String#repeat() method and unit tests for it.
It uses native implementation in ART.
This implementation is 4.7-40.9 times faster (depending on how large
result string is) than naive StringBuilder implementation.
| Test | Java, ns | ART, ns | Gain |
|------------------+------------+------------+-------|
| len:1 reps:1m | 15,553,793 | 379,730 | 40.96 |
| len:13 reps:10 | 724 | 154 | 4.7 |
| len:13 reps:100k | 7,099,111 | 553,559 ns | 12.82 |
Bug: 202962059
Test: atest CtsLibcoreOjTestCases:test.java.lang.String.StringRepeat
Test: atest LibcoreBenchmarkTests:libcore.benchmark.StringTest
Change-Id: Ic1d473a4f11e4f551e1af1485908110abcae4559
5 files changed