-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Change default of MapperFeature.DEFAULT_VIEW_INCLUSION
to false
in 3.0
#1484
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
Thank you for suggesting this: I hope to focus bit more on 3.x planning after getting 2.9 finalized. |
MapperFeature.DEFAULT_VIEW_INCLUSION
default setting
MapperFeature.DEFAULT_VIEW_INCLUSION
default settingMapperFeature.DEFAULT_VIEW_INCLUSION
to false
in 3.0
Being discussed here: based on which change will either made, or not. |
Discussion closed: will proceed with this change. |
@cowtowncoder let's add below to JSTEP-2. Leaving this here because, Currently laptop is blocked to edit anything from github.com. Will comeback and pick this up in 2 days 🥲. * `DEFAULT_VIEW_INCLUSION`: default to `false` (because the most common use case is to only keep properties or fields annotated with `@JsonView`.)
* [databind#1484](https://github.com/FasterXML/jackson-databind/issues/1484) |
@JooHyukKim Will add once it gets completed -- having some problems with PR (#4885). Basically PR initially had 12 fails; could fix/work-around 7 by configuring |
Right, I pulled and checked. Below tests are failing.
|
MapperFeature.DEFAULT_VIEW_INCLUSION
to false
in 3.0MapperFeature.DEFAULT_VIEW_INCLUSION
to false
in 3.0
Down to just 2 failures:
|
@cowtowncoder Could you please apply this change to the upcoming 3.0.0-rc4 as Spring does not customize the builder anymore and the old default breaks Spring use cases? |
There is on-going PR to resolve this issue #4885. |
Speaking of which, @sdeleuze has there been any reports about performance issue when set to |
@cowtowncoder Is there specific usage pattern that could possibly be bottleneck? |
|
Performance concern is mine: the problem is that with default setting of include if no view definition specified, and no View activated, the whole View processing pathway is ignored during serialization. Although I don't consider -10% performance penalty huge in general (it really isn't); since it is across all users, it'd be unfortunate thing to add. Maybe I'll find time try if I can reproduce my findings and think about it this a bit more. Aside from this, one thing I would strongly recommend Spring team -- regardless of how this setting goes -- is to retain capability of being able to override defaults. Just in case; it is quite likely defaults for Spring will diverge ever so slightly. |
There is maybe a misunderstanding or something I miss, but Spring ask should not have any performance impact when no view is activated. Our ask is that when I struggle to understand how and why the "view processing code path" with its 10% performance penalty should be involved when Could you please elaborate on why |
@sdeleuze I can understand that it'd seem no processing would occur if no View is defined, but there indeed is separate code path with more processing exactly even if no active view is specified but And I thought this was specifically for serialization. Ideally there wouldn't be difference of course, but I don't think that is easy to resolve. I'll dig up a pointer if you want to check it yourself. |
Ok. So figuring this out is trickier than I remember but basically entry points are:
but from thereon, processing needed in I think I do need to run |
Ok: after re-running combinations of:
over https://github.com/FasterXML/jackson-benchmarks/, I think TL;DNR is -- I no longer have concerns. It looks like:
although it is possible there might be bigger difference for some usage it seems unlikely and I am not going to block this change for dinky 2% performance degradation which is barely measurable. Not sure where I thought I see up to 10% difference earlier (possibly on 2.x? or maybe JDK 8 had bigger difference) but it is not there in I will proceed merging this later today for 3.0.0-rc4 @sdeleuze . |
PR merged, will be in 3.0.0-rc4. |
Great job @cowtowncoder ! |
In Jackson 2.x,
MapperFeature.DEFAULT_VIEW_INCLUSION
is set totrue
by default, but almost all users set it tofalse
because the most common use case is to only keep properties or fields annotated with@JsonView
.In Spring Framework and Spring Boot, we already modify this default value, but maybe the default setting could be modify in Jackson 3.x in order to avoid confusing users?
The text was updated successfully, but these errors were encountered: