Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3955

[perf] improve #{cc.attrs...} resolution, handling the map with a custom ELResolver



    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • None
    • None
    • JSR-344
    • None


      Section there is a part when you need to return a Map, and that map is resolved by MapELResolver, but that is not a good idea, because this resolver is the last of the EL Resolver chain. It is also necessary to call FacesContext.getCurrentInstance() internally to evaluate the target EL expressions. It would be better if this is still a map, but we force that another EL Resolver (it could be the same) handles this object (using a class cast that check if the object implements some interface). In that way, we can pass the FacesContext instance to a custom method that receives FacesContext as parameter, instead use Map.get().

      That simple change would increase performance of composite components, improving the speed of the EL evaluation.

      The point is the spec says that a map should be returned, but it doesn't say anything about that MapELResolver should resolve the map. So, the change proposed is add a custom ELResolver to handle #

      {cc.attrs...} map in the same way as MapELResolver, but make some shorcuts, like pass the FacesContext, and so on, improving composite components performance.

      We can use a flag to enable/disable this behavior, but let it as default enabled. Please note technically we are not breaking the spec, because it is not expected that MapELResolver or any other resolver handles #{cc.attrs...}





            lu4242 Leonardo Uribe
            lu4242 Leonardo Uribe
            0 Vote for this issue
            1 Start watching this issue