The poor performance of kotlin string replace

The manifestViewer tool of Dev Tools Pro is written by Kotlin, it’s so slowly on some devices. I found it’s caused by String.replace after performance tuning.


The size of the source text is about 1.1m, call replace three times, replace of Kotlin takes about 2123ms, replace of Java takes about 250ms.


why the performance is so poor. The source code of Kotlin is here, will found it use split and join. but Java use regx.

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">