Runtime performance: trimMargin
See original GitHub issueIn the current implementation(1.0.3
) queries are ran through trimMargin
function on each execution, which leads to completely unnecesarry allocations and resource usage.
I understands that it’s not much, but why do it in the first place when it doesn’t provide any benefit from doing so? If someone want’s to read the query in debug, he can just copy it and run through some sqlite formatter. It’s especially bad if you’re doing many small and formatted queries.
It’s even worse on native, since kotlin collections and some operations with them are slow (compared to jvm or other native languages).
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (9 by maintainers)
Top Results From Across the Web
Runtime performance: trimMargin #1265 - cashapp/sqldelight
In the current implementation(1.0.3) queries are ran through trimMargin function on each execution, which leads to completely unnecesarry ...
Read more >trimMargin - Kotlin Programming Language
Trims leading whitespace characters followed by marginPrefix from every line of a source string and removes the first and the last lines if...
Read more >[raw-strings] Indentation problem - OpenJDK mailing lists
Another possibility is to provide a method like trimMargin() on Kotlin [1] which trims all spaces before a special character (pipe by ...
Read more >Source Code for Errors.kt - AndroidX Tech
internal object Errors { /** * Same as trimMargins, but add newlines on either ... reduces | runtime performance in order to support...
Read more >Kotlin 1.3.40 released - The JetBrains Blog
Starting with this release, trimIndent and trimMargin calls are ... Kotlin/JS incremental compilation performance has been improved.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Last night after putting the baby to bed I took a shot at implementing this intrinsic in the Kotlin compiler. I got it working for margin and indent for non-interpolated strings only. Sending a PR to the compiler later today after beefing up the tests.
On Wed, Mar 6, 2019, 4:34 PM Jake Wharton <jakewharton@gmail.com wrote:
This was merged and will ship in Kotlin 1.3.40.
On Thu, Mar 7, 2019 at 9:41 AM Jake Wharton jakewharton@gmail.com wrote: