Skip to content

Heavy heap usage on JavaScript #344

@patricklucas

Description

@patricklucas

This is not really a bug with xmlutil, but there are possibly ways to mitigate the issue here.

Short version: Kotlin's CharArray.concatToString JavaScript implementation builds up strings character-by-character using +=, and KtXmlReader.text/KtXmlReader.get() calls concatToString on the buffer, resulting in an object allocated and retained for every byte in every text section.

I've opened an issue on Kotlin here: https://youtrack.jetbrains.com/issue/KT-84791/Many-string-operations-allocate-for-each-character

Per my suggestion at the bottom of that issue, I wonder if an improvement to xmlutil would be to induce string Cons compaction on JavaScript in particular immediately after the call to concatToString in KtXmlReader.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions