jump to navigation

Analyzing and Improving Your Website Performance January 16, 2008

Posted by ninadgawad in Javascript, Website Optimization.
add a comment

How many times have people said that your website is too slow and you found out that there is nothing you can do to improve its performance? The final option most of the times might have been either trying to change your hosting server (may be even blaming him for purposely slowing your website) or finding several ways to optimize your code.

Over last few months I have been facing this same problem. I browsed the web for answers, even went ahead and bought many books on Website Optimization. All of them more or less targeted the same issue of caching static contents using additional third party tools which improvises upon browser caching thus getting better performance and all that sort of stuff.

Analyzing the Website Performance

There were enough options to start that made me crazy as to which one to go ahead with, I wanted things to be under my control rather than adding complexities. For this I needed information as to what actually is traveling between my web server and web browser. I added loggers in my code to note the timestamps at server, even timed by database queries.

All I wanted to know was what actually was being downloaded by the client. In this situation one tool finally came to my rescue. That was .. Click Here to read the entire Post

LinkedHashMap or HashMap ? January 1, 2008

Posted by ninadgawad in Java.
Tags: ,
5 comments

The Class LinkedHashMap  is an extension of HashMap with specific feature of retaining the insertion order. Hence useful when order  of key-value pairs are to be retained. Also if one inserts the key again into the LinkedHashMap the original orders is retained. Such Collection is useful when you want to covert a record fetched from the database into a Java Object. The main advantage with this is that now we can shift the sorting logic of retrieved data into database rather than writing custom code here; that help in boosting performance.

Java Docs available @  http://java.sun.com/javase/6/docs/api/java/util/LinkedHashMap.html

Example Code:

import java.util.Iterator;
import java.util.LinkedHashMap;

class LinkedHashMapEx1  {
public static void main(String[] args)      {
LinkedHashMap map = new LinkedHashMap();

// Add some elements
map.put(“A”, “dataElement-1”);
map.put(“B”, “dataElement-2”);
map.put(“C”, “dataElement-3”);
map.put(“B”, “dataElement-4”);

// List the entries
for (Iterator it=map.keySet().iterator(); it.hasNext(); ) {
Object key = it.next();
Object value = map.get(key);
System.out.println( “Key = “+ key.toString() + ” Value = ” + value.toString() );

}
}
}