Skip to content
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

Add support for streaming input #48

Closed
wants to merge 1 commit into from

Conversation

spbnick
Copy link
Contributor

@spbnick spbnick commented Aug 31, 2020

Add support for accepting iterators as values for value and text,
output of which (values and strings respectively) is fed gradually into
the parser, yielding values as they are read.

This is useful for parsing and processing large streams of objects.

This is a rather quick solution, and might need improvement, but I'd like to know if such a contribution could be accepted in principle.

@spbnick spbnick force-pushed the support_streaming_input branch 2 times, most recently from 0eada66 to 5761a35 Compare August 31, 2020 16:55
Add support for accepting iterators as values for `value` and `text`,
output of which (values and strings respectively) is fed gradually into
the parser, yielding values as they are read.

This is useful for parsing and processing large streams of objects.
@spbnick spbnick force-pushed the support_streaming_input branch from 5761a35 to d91e4af Compare September 1, 2020 09:48
@mwilliamson
Copy link
Owner

I think I'd prefer to add a separate method rather than overloading the existing method for clarity -- for instance, adding an inputs() method. What do you think?

@spbnick
Copy link
Contributor Author

spbnick commented Sep 2, 2020

@mwilliamson, separate method works for me and makes sense! Especially since having an iterator producing values for input doesn't make much sense.

However, I've already worked past this locally, trying to speed up things and lower memory requirements. I have code for going directly from jv's to Python data, bypassing JSON representation. It's trivial, but it's twice as fast on large data sets.

I really only need stream parsing at this moment (which doesn't exist for Python otherwise), without passing the data through the program (which has speed and memory (?) overhead). So, I'm working on having a separate parser interface exposed (and perhaps used by "program"). I might be able to post it next week (with a separate method, as you request).

@spbnick
Copy link
Contributor Author

spbnick commented Sep 2, 2020

Thank you for taking a look at this, and I'm glad you're not against having support for streaming :)

@spbnick
Copy link
Contributor Author

spbnick commented Sep 8, 2020

Closing this in favor of #49. Would like to get around to implementing this on top of that.

@spbnick spbnick closed this Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants