Open zzrrxx opened 4 years ago
I tried to parse a 600 lines Golang code with the grammar file GoParser.g4 and GoLexer.g4, it almost needs about 20s with the Swift release build (80s for the debug build). I used Antlr4 4.7.2.
It sounds awful. I think there are performance problems with Swift runtime. Have you tried Java of C# ones?
Also, I suppose you implemented GoParserBase.swift
for Swift runtime? There are only C#, Java and Go files in the repository.
Thank you for your prompt reply.
I tried Java, it takes about 3s to parse the same Golang file.
Also, I suppose you implemented GoParserBase.swift for Swift runtime?
Yes, I write GoParseBase.swift according to the provided GoParserBase.java.
Anyway, it's too much time for such a small file.
So will you fix it in the near future?
No, maybe @ewanmellor (Swift target maintainer) can help. Could you please attach your Go file that's parsed too slowly?
The parsing file of such a file is less than 1 sec on my machine (Core i5, 3.5 GHz, 16 Gb) on C# runtime.
I use swift and use the Antlr4 in my ios app, could you please have a try?
Just as I mentioned before, Java version takes about 3 second in IntelliJ. So I think only Swift runtime’s performance is poor.
Thanks
在 2020年1月11日,下午11:26,Ivan Kochurkin notifications@github.com 写道:
The parsing file of such a file is less than 1 sec on my machine (Core i5, 3.5 GHz, 16 Gb) on C# runtime.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Unfortunately no, I don't have installed macOS. Java runtime also has better performance, maybe there are IntelliJ freezes.
I have MacOs, but will need some instructions.
@teverett Please keep me updated if you make any progress. Also, let me know if I can do anything for you.
I parsed a 663 lines Golang file, it needs about 120s. And when I parsed a 83 lines Golang file in examples/structs.go, it also needs about 20s with the Python3.8. It's too slow.
I used Antlr4 4.9.2 in Windows10. And I write GoParseBase.py according to the provided GoParserBase.go. Is this a problem with the Go language, or the file I wrote is not good enough? By the way, it's fast when parsing Java.
I tried to parse a 600 lines Golang code with the grammar file GoParser.g4 and GoLexer.g4, it almost needs about 20s with the Swift release build (80s for the debug build). I used Antlr4 4.7.2.
During running my parse app, a lot of reportAmbiguity and reportAttemptingFullContext error are reported.
My question is is there any tips or tricks to make it run faster? I tried the two-step parsing, it doesn't work for me. Any help? Thanks