In some scenarios AdvisedSupport.updateAdvisorArray()
takes about 30% of AdvisedSupport.addAdvisor()
(see attachment) and is pointless in fact, as the only place where we use advisorArray
is AdvisedSupport.getAdvisors()
. So we can rewrite the code to retrieve the array from the advisors
list only when it is necessary instead of rewriting it on each addition or removal of advice.
This allows to simplify code and remove advisorArray
. In order to reduce allocation rate I've also introduced AdvisedSupport.getAdvisorCount()
.