Last week I did some JMeter testing, profiling and code checking on MyFaces to try increase the overall performance. Here are my suggestions for improvement:
I introduced a cache for maps with component attributes. This cache avoids rebuilding the map for every instance of the same component class. It is implemented using a WeakHashMap to allow the GC to remove entries that are not referenced in any instance.
Made a few changes in isIdValid as it is called quite often. The new id is now checked against the old id and if it is the same it is assumed as valid (avoids checking chars). Additionally I use isLetterOrDigit() and access string chars directly insted of fetching an array first.
I replaced List with Map to avoid iteration over lists.
Use new method of HTMLEncoder for char
Improved performance of encode mthod and added a new one that takes a char und directly writes to a writer.
Replaced StringBuffer with StringBuilder.