Skip to content

Stream API doesn't work without Javassist dependency #32

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

Closed
ekuleshov opened this issue Jan 31, 2017 · 8 comments
Closed

Stream API doesn't work without Javassist dependency #32

ekuleshov opened this issue Jan 31, 2017 · 8 comments

Comments

@ekuleshov
Copy link

Javassist is listed as an optional dependency, however the following method is failing com.jsoniter.JsonIterator.parse(InputStream in, int bufSize) when Javassist is not available.
This shouldn't be happening for stream-only or static code generation.

@taowen
Copy link
Contributor

taowen commented Jan 31, 2017

stream api is considered as "optional". 99% percent of time, byte array input will be the best option.

@taowen taowen closed this as completed Jan 31, 2017
@ekuleshov
Copy link
Author

Guess I am at that 1%. I have to process large json files and it is not possible to load them into the byte arrays held in memory. It should be possible to use streaming and writer API without dynamically linking anything or generating any code at runtime.

@taowen taowen reopened this Jan 31, 2017
@taowen
Copy link
Contributor

taowen commented Jan 31, 2017

The best option is to make a fork of this library. Delete IterImpl.java and rename IterImplForStreaming.java to IterImpl.java. The idea is to support streaming mode without virtual method call. So Javassist is used to shadow the class in runtime.

@ekuleshov
Copy link
Author

That is pretty much what I had to do, but it is not maintainable like that. I'd have to stick with Jackson if that would be the only option.

As a thought. Maybe make it other way around. Stream by default and replace virtual call when dynamic codegen is used... or provide JsonIteratorStream hardwired with IterImplForStreaming

@taowen
Copy link
Contributor

taowen commented Jan 31, 2017

how about I maintain the fork for you? like lite version. It is just a bash script to copy the files needed over. What features do you need? Encoding or decoding? Iterator only or more?

@ekuleshov
Copy link
Author

Thank you for a generous offer, but that won't be necessary.
I completed evaluation of Jsoniter. Really like simplicity of the stream API. But I didn't get a significant performance increase over jackson 1.x for my project when parsing large json datasets using stream api. Also jackson is more forgiving when parsing various data types. So I will have to keep my existing implementation.

@taowen
Copy link
Contributor

taowen commented Feb 1, 2017

switch case based on string field is slow. that is the biggest bottleneck in all the parsing process.

@taowen taowen closed this as completed Feb 1, 2017
@ekuleshov
Copy link
Author

I still see quite a bit of jsoniter code at the top of the list:

image

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

2 participants