Phoenix: Investigate using Jason instead of Poison

Created on 24 Dec 2017  路  9Comments  路  Source: phoenixframework/phoenix

This will also require changing phoenix_ecto / ecto.

Most helpful comment

The primary reason is performance. Jason is about twice as fast and uses half the memory while being almost 100% functionally compatible with Poison (it covers all the features used directly in Phoenix).

All 9 comments

What can of investigation needs to be done for this? Is it:

  • How much effort it would be
  • Seeing if there is a performance boost
  • Something else?

It won't be a large effort. The only thing to evaluate is the readiness of Jason stability and prod ready wise.

The biggest difference of Jason vs Poison is that Jason does not allow encoding arbitrary structs - it always requires either implementing or deriving the protocol. This would mean the change wouldn't be completely seamless - fortunately, deriving the protocol is just one line Protocol.derive(Jason.Encoder, MyStruct).

Just an FYI, I've released version 1.0.

@josevalim this is taken care of in #2734 , and phoenix_ecto no longer depends or implements any Poison protocol so we are good there. What needs done on Ecto's side to make this complete?

Can someone explain what are the benefits of using Jason instead of Poison?

The primary reason is performance. Jason is about twice as fast and uses half the memory while being almost 100% functionally compatible with Poison (it covers all the features used directly in Phoenix).

Will this be released to 1.3?

@javierg if you look at Jason's readme, instructions are provided for use with phoenix 1.3:
https://github.com/michalmuskala/jason/blob/master/README.md

Was this page helpful?
0 / 5 - 0 ratings