Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion [2.0] JSON in Play
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Guillaume Bort  
View profile  
 More options May 31 2012, 6:03 am
From: Guillaume Bort <guillaume.b...@gmail.com>
Date: Thu, 31 May 2012 12:03:15 +0200
Local: Thurs, May 31 2012 6:03 am
Subject: Re: [play-framework] [2.0] JSON in Play

> So, should I implement it in some different way, or can my original pull
> request be accepted?

Sorry, you must definitely implement this in a different way. I agree
that it would be an interesting optimization but it shouldn't be tied
to any Plugin concept (and neither to the application lifecycle).
Please think about the Json support as a separate library.

On Thu, May 31, 2012 at 11:59 AM, James Roper <jrop...@gmail.com> wrote:
> Hey all,

> I'd like to address the topic of JSON parsing in Play again.  Just to put
> some hard numbers on this, yesterday, unrelated to play framework, I was
> looking at some code that someone told me was going much slower than
> expected.  It was taking about 120 milliseconds to do something that they
> expected to only take a few milliseconds.  We quickly determined that the
> major part of the issue was that they weren't reusing the Jackson
> ObjectMapper.  Once they reused the Jackson ObjectMapper, the time of this
> thing (including the IO involved in this operation) went down to 5
> milliseconds.  So you can see that creating an ObjectMapper each time you
> need to use it can have a massive performance impact.

> I submitted this pull request, but it was rejected because it made json
> support a "plugin":

> https://github.com/playframework/Play20/pull/225

> Actually, I wasn't interested in making JSON support a plugin, all I wanted
> was the ability to initialise an ObjectMapper on application start,
> and reinitialise it each time the application is updated (in development,
> this is needed, because Jackson might not pick up changes in annotations).
>  The only way I can see for an internal component in play to hook into play
> to do this is to implement the Plugin interface, from where it gets notified
> of application start events.  This is the same way that other core non
> plugin components of Play seem to do it.  In fact, I put the JSON plugin
> into Plays own play.plugins file, which means it's impossible to disable
> it... which means it's not really a plugin at all, it's just using the
> plugin mechanism to hook into application start events.  I would have
> thought this is the sensible way to go about doing that, am I wrong?  If I
> am wrong, what is the correct way for a core play component to hook into
> application start events?

> I also wanted to provide a way to configure the ObjectMapper play uses (for
> example, to register custom serialisers/deserialisers), which also requires
> doing things on application start... and using the Plugin interface seemed
> to be the right way to do this too.

> Also, Scala JSON support is already using a singleton instance, though
> perhaps we want to provide a mechanism for configuring the ObjectMapper in
> Scala, but I think this is a separate issue, because the code bases in both
> the Java and the Scala support are completely different.

> So, should I implement it in some different way, or can my original pull
> request be accepted?

> Cheers,

> James

> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/zsJdd-rJ-sMJ.
> To post to this group, send email to play-framework@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framework+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.

--
Guillaume Bort, http://guillaume.bort.fr

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.