Performance Issue UrlMapping.getPatternParser()

Splash Forums PrettyFaces Users Performance Issue UrlMapping.getPatternParser()


This topic contains 5 replies, has 2 voices, and was last updated by  Christian Kaltepoth 10 years, 6 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #17995

    Frank Caputo


    I’ve found a performance issue:

    UrlMapping.getPatternParser() is called quite often. This should be no problem if the pattern parser was cached. But the dirty-flag is never set to false, so a new pattern parser will be created for every call to UrlMapping.getPatternParser().

    If I had an idea, when to set the dirty flag to false, I could fix it.

    Ciao Frank


    Hey Frank!

    Thank you very much for pointing us to this issue. This is definitively a bug. A just committed a fix for it:

    Could you perhaps give the latest snapshots a try (3.3.1-SNAPSHOT)? They should be automatically deployed to our repository in about 20 minutes. You will find all the details you need to include the snapshots in your project here:

    And thanks again for bringing this up! We are always happy to get any kind of feedback! :)



    Frank Caputo

    I will check it tomorrow or next week. I will do further performance measuring, since we are building a high performance website.

    Ciao Frank


    Awesome! It would be great if you could tell us about the results! :)


    Frank Caputo

    It is much better now, but URLPatternParser still seems to be created to often:



    URLPatternParser seems to be threadsafe, so you could simply call com.ocpsoft.pretty.faces.config.mapping.UrlMapping#getPatternParser()

    Another point is the use of String.split, matches etc.:





    These methods always create new Pattern instances. If you have a regex, try to compile it and reuse it. If you don’t have a regex, just use one of the org.apache.commons.lang.StringUtils methods. Or simply String.indexOf(…).

    Hope this helps.

    Ciao Frank

    PS: to check if the sessionid is in the url, just use javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromURL


    Thanks for this analysis and your feedback. I really appreciate this.

    I’ll try to find some time to take a deeper look at this.

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.