...
- assuming that a given topic is in the forum at all, the result from hasPreviousTopic will always be "true" after the first iteration.
- the result of hasNextTopic will always be"true" unless it is the last topic
possible fix: change loops to...Code Block title for hasNextTopic() return (topics.size()>1 && !((Topic)topics.get(topics.size()-1)).equals(topic));
Code Block title for hasPreviousTopic() return (topics.size()>1 && !((Topic)topics.get(0).equals(topic));
getDecoratedTopic
- save the results of previous invocations at the least. This should alone reduce CPU load spent in the parent method by 50% and response times by about %30 (4 seconds)
possible fix: save results of the above to method calls.
results of changes:
48% of cpu time spent in getDecoratedTopic is in hasNextTopic
39% of cpu time spent in getDecoratedTopic is in hasPreviousTopic
total response time decreased to as much little as 40%
Load testing should reveal real numbers.