Reputation: 1624
We found that the performance of the current web page is very poor as we are generating the HTML based on the data coming from the server. We are currently iterating the MAP of type
MAP<Integer, Map<String, Object>>
using <C:FOREACH>
and generating the HTML content.
My question is what is the better way of iterating the Map in java class or in JSP. Is there any annotations based tags available to iterate a Map?.
Thanks
Upvotes: 0
Views: 225
Reputation: 16615
I would also be very surprised if iterating the map was the source of a performance bottleneck. Developers (me included) are well known for being very, very bad at determining where a bottleneck is just by inspecting the code.
Get yourself a profiler (I use YourKit since they give free copies to open source committers - other profilers are available) and see where the time is actually being spent.
Upvotes: 0
Reputation: 425033
The fastest and best way to iterate a map is:
Map<Integer, Map<String, Object>> map;
for (Map.Entry<Integer, Map<String, Object>> entry : map.entrySet()) {
Integer key = entry.getKey();
Map<String, Object> value = entry.getValue();
...
}
Upvotes: 2