FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

SAX Interface? · Issue #114 · python-rapidjson/python-rapidjson · GitHub

Repository navigation

SAX Interface? #114

Description

How difficult would it be to also expose the SAX interface so we can process files that are much larger than can fit in RAM?

I am currently using ijson which has a yajl backend, but it's about 5x slower than RapidJSON.

Activity

  1. lelit commented on Dec 2, 2018

    Contributor

    I do not foresee particular difficulties: a quick look seems to tell that what is missing is a way to expose the handler object...

    Cannot say when I will be able to spend time on this, though, sorry.

  2. liujimj commented on Dec 4, 2018

    Author

    @lelit Thanks, I would work on it myself, but it's been a long time since I've touched C++.

    ijson seems pretty popular (500+ stars) precisely because incremental parsing is so useful. I would switch over to RapidJSON's SAX implementation if I had a choice.

  3. lelit commented on Dec 4, 2018

    Contributor
  4. lelit commented on Dec 4, 2018

    Contributor

    A quick look at ijson reveals that what you want is not the SAX interface, but rather an iterative interface to the reader, something more complicated because RJ does not expose out-of-the-box, AFAICT.

  5. liujimj commented on Dec 4, 2018

    Author

    Yes, I think you are right, although it looks like there is are IterativeParse methods on the Reader class which takes a Handler: http://rapidjson.org/md_doc_sax.html (under 'Token-by-Token Parsing')

    Perhaps the easiest way to expose this is to write a pass-through Handler that just re-emits the events, that is very close to the interface that ijson provides. Not sure how fast an FFI call is now, if naive implementation is too slow then one could batch events to emit back to Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL