Skip to content

LiveScript compiler takes forever to parse a file ending with a comment containing many # #279

@robotlolita

Description

@robotlolita
$ lsc --version
LiveScript 1.1.1

So, I'm not sure if the issue is with the parsing, although it's the most likely conclusion, the case is that the parsing time seems to increase a lot depending on the number of # you have at the end of your file.

The interactive prompt below shows the progression in parsing/compilation time from 25 single-line comment characters up to 28 of them:

$ printf "#########################" > test.ls
$ time lsc -cbp test.ls

real    0m0.796s
user    0m0.788s
sys 0m0.008s

$ printf "##########################" > test.ls
$ time lsc -cbp test.ls

real    0m1.483s
user    0m1.476s
sys 0m0.012s

$ printf "###########################" > test.ls
$ time lsc -cbp test.ls

real    0m2.836s
user    0m2.836s
sys 0m0.016s

$ printf "############################" > test.ls
$ time lsc -cbp test.ls

real    0m5.573s
user    0m5.580s
sys 0m0.020s

However, if the comment isn't the last line in the file, the parsing time is fine:

$ printf "############################\n" > test.ls
$ time lsc -cbp test.ls

real    0m0.116s
user    0m0.096s
sys 0m0.016s

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