-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to parse only one part of the file #298
Comments
Without manipulating data structures during the parse or creating customized implementations of |
Is it possible to give an example of how to divide the file into smaller units ? |
@jvratanar The process would be highly application-specific, but the basic assumption to operate under is ANTLR will buffer all of the data available via A custom |
I thought UnbufferedCharStream and UnbufferedTokenStream were the way to go when dealing with large files as it is recommended in the ANTLR book, page 241, 245. On this web application users upload files which are then parsed and validated. However files are big |
I was able to solve it like this:
|
Is it possible to parse only let's say first half of the file with antlr4? I am parsing large files and am using UnbufferedCharStream, UnbufferedTokenStream. I am not bulding parse tree and am using parse actions instead of visitor/listener patterns. With these i was able to save significant amount of RAM and parse speed.
However it still takes around 15s to parse the whole file. The parsed file is divided in two sections. First half of the file has metadata, the second one the actual data. The majority of the time is spent in data section as there are more than 3mio. lines to be parsed. The metadata section has only around 20000 lines. Is it possible to parse only the first half, which would improve parse speed significantly? Is it possible to inject EOF manually after the metadata section? How about dividing the file into two?
The text was updated successfully, but these errors were encountered: