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

performance review? #7

Closed
Ziemien opened this issue Mar 31, 2017 · 2 comments
Closed

performance review? #7

Ziemien opened this issue Mar 31, 2017 · 2 comments

Comments

@Ziemien
Copy link

Ziemien commented Mar 31, 2017

Hi

How does the performance compare with existing libraries such as Jackson? I consider using it for network application in which JSON messages arrive in chunks.

@michel-kraemer
Copy link
Owner

This is a very good question! You cannot really compare Actson and Jackson, because they have completely different architectures. Personally, I love Jackson very much and use it whenever I can because it's extremely fast and easy to use. Tatu has put a lot of work in optimizing Jackson and making it one of the fastest and versatile JSON parsers available.

Actson on the other hand is also extremely fast. The parser code is very small and doesn't leave much room for optimisation. I think, it's on par with Jackson. I can't present numbers, but I did a bit of benchmarking a while ago and it looked really good. Feature-wise it's not as comprehensive as Jackson, not least because it does not support generating JSON.

It all depends on your use case. If you need something that is easy to use and reliable, go for Jackson. However, if you need an asynchronous non-blocking parser then you should use Actson. In practise you won't see much difference between the two performance-wise. But if your application already is non-blocking (e.g. if you're using Vert.x or something similar) then you might actually get a better performance with Actson overall (at least in terms of scalability probably).

Let me know if this helps! Please close the issue if you don't have any further questions. Thanks!

@htmldoug
Copy link

Jackson just added an async parser in FasterXML/jackson-core#57 and published a pre-release
(jackson-core-2.9.0.pr4).

I've put together two benchmarks:

  1. bookstoreAllBytesAtOnce parses bookstore.json and makes the bytes available immediately
  2. oneHundredBookStoresStreamed parses an array of 100x bookstore.json one bookstore byte[] at a time.
> bench/jmh:run -wi 15 -i 30 -f3 -t1 .*
[info] Benchmark                                    (implementation)   Mode  Cnt       Score      Error  Units
[info] JsonBenchmarks.bookstoreAllBytesAtOnce                 actson  thrpt   90   91527.435 ± 1423.217  ops/s
[info] JsonBenchmarks.bookstoreAllBytesAtOnce                jackson  thrpt   90  228358.584 ± 3672.275  ops/s
[info] JsonBenchmarks.oneHundredBookStoresStreamed            actson  thrpt   90    1018.986 ±   22.096  ops/s
[info] JsonBenchmarks.oneHundredBookStoresStreamed           jackson  thrpt   90    3335.238 ±   60.136  ops/s

Jackson's NonBlockingJsonParser appears to be 2x-3x faster than actson over these tests.

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

3 participants