Excessive use of listeners could result in severe performance problem. One example is the code at work where a user operation takes as long as 2 minutes to finish. Profiling shows that some methods are repeatedly called for a ridiculous number of times (279398 times for getFont()). Further analysis shows that it is caused by the chain reaction resulted from the listeners.
It would be too painful to fix those listeners from the group up (I would rather rewrite the whole thing). A quick but effective fix is to mark the user operation as a batch, and skip any calls to those methods when in the batch. Since there are still some duplicated calls to those methods, it turns out that the code still works but much faster. :)
userOperation() {
beginBatch();
...
endBatch();
}
method_result_in_duplicate_calls() {
if (inBatch()) byebye;
...
}