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

detailed documentation and examples #22

Open
faker09 opened this issue Aug 5, 2021 · 8 comments
Open

detailed documentation and examples #22

faker09 opened this issue Aug 5, 2021 · 8 comments

Comments

@faker09
Copy link

faker09 commented Aug 5, 2021

there is not any documentation to introduce any function and module. so it is difficult to use it for a person that have not experience

@faker09
Copy link
Author

faker09 commented Aug 6, 2021

there is not cysimdjson.JSONParser().parse_string function

@faker09
Copy link
Author

faker09 commented Aug 6, 2021

it look like that cysimdjson is not yet finished

@seperman
Copy link

The Readme.md says there is a parser.loads function but there is no such a thing:

>>> parser = cysimdjson.JSONParser()
>>> parser.loads
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'cysimdjson.JSONParser' object has no attribute 'loads'

@ateska
Copy link
Contributor

ateska commented Nov 6, 2021

@seperman - you likely used some intermediate (master) version.
The cysimdjson underwent an architecture refactoring at that time, sorry for inconvenience.

Current version behaviour:

>>> parser = cysimdjson.JSONParser()
>>> print(parser.loads)
<built-in method loads of cysimdjson.JSONParser object at 0x7ffe9fe25ab0>
>>> print(parser.parse_string)
<built-in method parse_string of cysimdjson.JSONParser object at 0x7ffe9fe25ab0>

@ateska
Copy link
Contributor

ateska commented Nov 6, 2021

In general, for a newcomers I would recommend to stick with pysimdjson - it is more user-friendly and comparably fast in version 4.0

This project remains alive mainly b/c we are squeeze some performance from it in very specific case: using C API in the code that lives outside of the Python (C code) and still needs an access to parsed JSON structures.
If that's possible with pysimdjson, this one could be closed since it served its original purpose.

@TkTech
Copy link

TkTech commented Dec 6, 2021

If that's possible with pysimdjson, this one could be closed since it served its original purpose.

I'm happy to support this use case if you can describe the API you need exposed on the C side of things.

@ateska
Copy link
Contributor

ateska commented Dec 6, 2021

If that's possible with pysimdjson, this one could be closed since it served its original purpose.

I'm happy to support this use case if you can describe the API you need exposed on the C side of things.

The generic idea is that the "other code" (meaning non-Python, maybe Cython, maybe LLVM IR, maybe other compiled/binary code) would like to access the parsed JSON, using simdjson directly using the element that has been parsed by cysimdjson.

This is an API: https://github.com/TeskaLabs/cysimdjson/blob/main/cysimdjson/cysimdjsonc.h - it is basically a simplistic wrapper of C++ code in the opaque C memory block + set of bridging functions that allows to call specific method of simdjson.

@TkTech
Copy link

TkTech commented Dec 9, 2021

I've taken a look at it and I see no issue supporting it, although I might change how you acquire it to be a bit different, passing around a PyCapsule so that it can be passed around safely in C or via Python to other C functions without void typing and with support for garbage collection. I'll look at adding it towards the end of December when the office is on holidays.

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

No branches or pull requests

4 participants