You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Thomas Andraschko (Jira)" <de...@myfaces.apache.org> on 2020/04/19 11:27:00 UTC

[jira] [Comment Edited] (MYFACES-4330) [perf] Bad performance of ResourceHandlerImpl because of unnecessary MissingResourceException

    [ https://issues.apache.org/jira/browse/MYFACES-4330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17085977#comment-17085977 ] 

Thomas Andraschko edited comment on MYFACES-4330 at 4/19/20, 11:26 AM:
-----------------------------------------------------------------------

Great patch!

Nevertheless, you can create PRs here: [https://github.com/apache/myfaces]
 Please note: we need at least a PR for master, 2.3.x and 3.0.x
 If you would like to see it in 2.2, we also need a PR for the 2.2.x branch


was (Author: tandraschko):
Great patch!
DO you have some numbers of the performance improvements?

Nevertheless, you can create PRs here: [https://github.com/apache/myfaces]
Please note: we need at least a PR for master, 2.3.x and 3.0.x
If you would like to see it in 2.2, we also need a PR for the 2.2.x branch

> [perf] Bad performance of ResourceHandlerImpl because of unnecessary MissingResourceException
> ---------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-4330
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4330
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.2.12
>            Reporter: Reto Weiss
>            Priority: Major
>             Fix For: 2.2.13, 2.3.7, 3.0.0, 2.3-next-M3
>
>         Attachments: myfaces.patch
>
>
> While processing JSF resource requests a lot of MissingResourceExceptions are thrown and catched right afterwards if you have a message bundle installed but no resource for the key 'javax.faces.resource.localePrefix' is provided (like in the case of Primefaces).
> This can lead to performance problems because creating and throwing an exception is a heavy operation. The throwing of the exception can be prevented by first checking if a resource contains a certain resource before accessing it:
>          try            {
>                 ResourceBundle bundle = ResourceBundle
>                         .getBundle(bundleName, locale, ClassUtils.getContextClassLoader());                if (bundle != null)
>                 {                    if (bundle.containsKey(ResourceHandler.LOCALE_PREFIX))
>                     \{
>                       localePrefix = bundle.getString(ResourceHandler.LOCALE_PREFIX);
>                     }
>                 }
>             }            catch (MissingResourceException e)
>             {                // Ignore it and return null            }
> By applying the above patch I see a 50% reduction of the execution time of the method createResource.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)