Typesafe Config Json parsing performance

273 views
Skip to first unread message

Michael Li

unread,
Apr 5, 2016, 3:05:28 PM4/5/16
to scala-user
Has anyone done performance comparison between Typesafe config with other Json parser like Json4s-jackson? Is it good enough to be used as general json parser in a heavy load API service? 

Yann Simon

unread,
Apr 5, 2016, 3:14:19 PM4/5/16
to Michael Li, scala-user
I made some tests here: https://github.com/yanns/scala-json-parsers-performance
I advise you to look at the JMH test results.

Le mar. 5 avr. 2016 à 21:05, Michael Li <m...@ooyala.com> a écrit :
Has anyone done performance comparison between Typesafe config with other Json parser like Json4s-jackson? Is it good enough to be used as general json parser in a heavy load API service? 

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Li

unread,
Apr 5, 2016, 3:18:36 PM4/5/16
to scala-user, m...@ooyala.com
Thanks for your post. I was asking typesafe config's performance, but I can't find it in your list.

[info] Parameters(parser -> argonaut): 0.194616
[info] Parameters(parser -> jackson): 0.058777
[info] Parameters(parser -> json4sJackson): 0.224313
[info] Parameters(parser -> json4sNative): 0.23916
[info] Parameters(parser -> playJson): 0.245464
[info] Parameters(parser -> sphereJson): 0.143125
[info] Parameters(parser -> sprayJson): 0.198715

Yann Simon

unread,
Apr 5, 2016, 3:22:04 PM4/5/16
to Michael Li, scala-user
sorry, I saw JSON and misunderstood your request.

Julien L.

unread,
Apr 6, 2016, 5:24:23 AM4/6/16
to scala-user, m...@ooyala.com
The HOCON format has much more feature than plain JSON (variable substitution, expression, merging...), so it will be slower than any JSON parsing library.

Besides, the configuration file is parsed one time when the app start, so performance is not the priority.

I'll not use the typesafe config parser for an heavy load API. Go to Json, with for example Circe or any API backed by Jawn.

Naftoli Gugenheim

unread,
Apr 7, 2016, 4:53:26 PM4/7/16
to Julien L., scala-user, m...@ooyala.com


On Wed, Apr 6, 2016, 5:24 AM Julien L. <yotsu...@gmail.com> wrote:
The HOCON format has much more feature than plain JSON (variable substitution, expression, merging...), so it will be slower than any JSON parsing library.

Besides, the configuration file is parsed one time when the app start, so performance is not the priority.

That's up to your application.

Glen Marchesani

unread,
Apr 8, 2016, 1:29:16 PM4/8/16
to scala-user, yotsu...@gmail.com, m...@ooyala.com

We have a workflow app where a lot of the extended features are exposed via HOCON stored in a database table.  Under load we are parsing a 10 to 20 HOCON docs (10 to 100 lines each) a second just fine.  We also know if we need to get more performance we can easily add an MRU caching layer to give us an order of magnitude boost.  So I would say it really is a balance between need for the extended capabilities of HOCON over json and high performance parsing.  We targeted 100 / 100 line json docs per second and felt we could achieve that with HOCON (noting that translates into like 50K requests per second on our app).

Note #1: we also looked at and were impressed with https://hjson.org/ 

Note #2: we actually parse the HOCON then process the HOCON layers into a json4s JValue (so the performance is for doing all of that not just the HOCON parse, the HOCON parse takes the majority of the cycles).
Reply all
Reply to author
Forward
0 new messages