-
-
Notifications
You must be signed in to change notification settings - Fork 812
Provide implementation of async JSON parser fed by ByteBufferFeeder
#478
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
Comments
That would be good addition: I always assumed there would be need for it. Note to potential implementors: beyond feeder, bigger job is to implement actual parser that uses |
Does it make sense to switch internals of NonBlockingJsonParser to ByteBuffer and add 2 new methods |
Any updates on this? Having to convert It seems that #483 is hanging. Are there any performance concerns for it? |
Successfully using https://github.com/kptfh/json-reactive in https://github.com/Playtika/feign-reactive |
@kptfh Thanks. Might use your |
Some would need to show that adding a layer of abstraction does not measurably (say, no more than 5% slower) slow down existing Either approach (show suggested patch has no significant performance overhead; add more sizable complete On testing, there is: https://github.com/FasterXML/jackson-benchmarks which actually does have async variant already. Could test one of releases, and then build from branch. I unfortunately do not have time to do this. |
Ok so here's my take on this... (see here) I've tried two possible approaches:
Another option might be to have two versions of As with performance, the "toggling" parser's thrpt seems exactly the same as the original with |
@mizosoft first of all, thank you for running tests, sharing result. This is useful and gives some data to consider performance aspect. Couple of questions:
I am not surprised by wrapping (or, use of One other thought: I agree that maintenance of 2 implementations would be unfortunate. Not the end of the world -- already there are 4 backends (byte / char, non-blocking, DataInput) -- but not ideal. Alternatively it might be possible to do extraction as you mention, and trust JVM to inline single-byte access method (the only difference between two). That is a possibility too. |
@cowtowncoder No worries :)
Yes, parser benchmarks have 5 warmup and 10 measurement iterations, 5 seconds each.
Aha. I also added a benchmark for feeding mixed chunks. I think this skewed JVM's branch-prediction and regressed performance w.r.t the wrapping variant. But as you said, most uses come from one feeder and this should rarely affect real world cases. As with code generation, I think this might be the best of both worlds since you can maintain one version and have the other generated without sacrificing performance. I'm not sure I know a tool that would cover this exact use case, but maybe one can come up with an ad-hoc solution using something like javapoet. Will have to do some research for this. |
This should be sorted out by #795 That PR adds a |
ByteBufferFeeder
Yes. Thanks to @pjfanning we now finally have |
This commit upgrades Jackson to 2.14.0-rc2, and uses the new ByteBufferFeeder in Jackson2Tokenizer. Unfortunately, because of FasterXML/jackson-core#478, we had to change the CompilerConventions to suppress class file warnings. Closes gh-29343
Currently, there is no implementation of
com.fasterxml.jackson.core.async.ByteBufferFeeder
provided in Jackson Core; there is only an implementation ofByteArrayFeeder
. Within Spring Framework, this requires us to covert the (potentially non-heap-allocated) ByteBuffers into byte arrays before feeding them to the parser, resulting in insufficient memory usage.Please provide an implementation of
ByteBufferFeeder
.The text was updated successfully, but these errors were encountered: