You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by "Matt Benson (JIRA)" <ji...@apache.org> on 2018/10/17 17:55:00 UTC

[jira] [Resolved] (BVAL-154) reduce memory footprint of BeanMeta

     [ https://issues.apache.org/jira/browse/BVAL-154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson resolved BVAL-154.
------------------------------
       Resolution: Fixed
    Fix Version/s:     (was: 1.1.3)

> reduce memory footprint of BeanMeta
> -----------------------------------
>
>                 Key: BVAL-154
>                 URL: https://issues.apache.org/jira/browse/BVAL-154
>             Project: BVal
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 1.1.2
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Major
>             Fix For: 2.0.0
>
>
> While doing some performance analysis on a project I figured that we store way too many BeanMeta instances. 
> This seems to come from other frameworks checking whether a class has BeanValidation features on them. 
> It also happens within our own CDI BValExtension. 
> The result is that we also cache the BeanMeta for every class which gets queried, regardless whether it has some validation on them or not.
> We should introduce a 'negative cache' which contains classes which are known to have no validation on them
> {code:java}
> getConstraintForClass(Calss c) {
>   if (negativeCache.contains(c)) 
>     return new EmptyBeanDescription(c);
>   ...
>   if (noValidationFeatureFound)
>     negativeCache.add(c);
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)