kotlinx/ast

KotlinGrammarAntlrKotlinParser very slow for files with json-strings

Closed this issue · 4 comments

Creating a file like this:

package testpackage.

val LARGE_JSON = """
     <very large json with 77000 lines>
"""

Running

val source = AstSource.String("", stringSource)
val kotlinFile = KotlinGrammarAntlrKotlinParser.parseKotlinFile(source)

takes very long on a file like this. If I replace the JSON in the string with base64, it will be much faster.
Does the grammar somehow inspect the braces inside the templating?

Any news on this?

Hi @fab1an,

sorry for the missed answer. I think this is related to #3. Sadly I have currently no time to work on this :-/

@drieks What I find interesting is that parsing json inside a string is very slow (maybe due to templating literals), whereas parsing a garbage-base64 string is fast.

Duplicate of #3