Improve Performance by caching and compression

Web page designs are becoming innovative with rich interface which involve extra code such as java scripts, css, and images etc. Most of the end-user response time tied-up in downloading these components.Optimizations of number of http requests and response size are the key parameters to improve the web application performance. Continue reading

Java Version History

Java Version History
Thought to share some of the old Java version released
New features in Java SE 7
Code named Dolphin and released on July 28, 2011.
  • Strings in switch Statement
  • Type Inference for Generic Instance Creation
  • Multiple Exception Handling
  • Support for Dynamic Languages
  • Try with Resources
  • Java nio Package
  • Binary Literals, underscore in literals
  • Diamond Syntax
New features in Java SE 6
Code named Mustang and released on December 11, 2006
  • Scripting Language Support
  • JDBC 4.0 API
  • Java Compiler API
  • Pluggable Annotations
  • Native PKI, Java GSS, Kerberos and LDAP support.
  • Integrated Web Services.
  • Lot more enhancements.
New features in J2SE 5.0
Code named Tiger and released on September 30, 2004.
  • Generics
  • Enhanced for Loop
  • Autoboxing/Unboxing
  • Typesafe Enums
  • Varargs
  • Static Import
  • Metadata (Annotations)
  • Instrumentation
New features in J2SE 1.4
Code named Merlin and released on February 6, 2002 (first release under JCP)
  • XML Processing
  • Java Print Service
  • Logging API
  • Java Web Start
  • JDBC 3.0 API
  • Assertions
  • Preferences API
  • Chained Exception
  • IPv6 Support
  • Regular Expressions
  • Image I/O API
New features in J2SE 1.3
Code named Kestrel and released on May 8, 2000.
  • Java Sound
  • Jar Indexing
  • A huge list of enhancements in almost all the java area.

New features in J2SE 1.2

Code named Playground and released on December 8, 1998.

  • Collections framework.
  • Java String memory map for constants.
  • Just In Time (JIT) compiler.
  • Jar Signer for signing Java ARchive (JAR) files.
  • Policy Tool for granting access to system resources.
  • Java Foundation Classes (JFC) which consists of Swing 1.0, Drag and Drop, and Java 2D class libraries.
  • Java Plug-in
  • Scrollable result sets, BLOB, CLOB, batch update, user-defined types in JDBC.
  • Audio support in Applets.

New features in JDK 1.1

  • JDBC (Java Database Connectivity)
  • Inner Classes
  • Java Beans
  • RMI (Remote Method Invocation)
  • Reflection (introspection only)

JDK Version 1.0

Codenamed Oak and released on January 23, 1996.
Wishing you a happy new year!

Class member variable initialization

While declaring the class member variables we have to be very confident about the behavior of the member variables. For example some variable are constant and will be same across the class life cycle and some are instance variables which will be tightly bind with the object (instance) of the class.

When an instance of a class is created using new, initialization of the class’s instance variables create for each unique instance.

Always use the static for the member variable which doesn’t change across the objects of the class.

I would try to check the performance using the below code sample:

public class TestClassVariable {

public TestClassVariable() {

// do nothing

}

public String country[] = { “India”, “USA”, “China”, “UK” };

public static void main(String s[]) {

long start, end;

int[] a = new int[1000000];

start = System.currentTimeMillis();

for (int j = 0; j length; j++) {

TestClassVariable tstClassVar = new TestClassVariable();

}

end = System.currentTimeMillis();

System.out.println(end – start + ” “

+ ” milli seconds execution time”);

}

}

Result: 94 milli seconds execution time

In the above code we used country as class instance variable and it takes 94MS but as we know country could be make as static member variable because it will be not going to change across the instances so the correct way to use as static member variable.

So we can change the program slightly and see the figures again


public class TestClassVariable {

public TestClassVariable() {

// do nothing

}

public static String country[] = { “India”, “USA”, “China”, “UK” };

public static void main(String s[]) {

long start, end;

int[] a = new int[1000000];

start = System.currentTimeMillis();

for (int j = 0; j length; j++) {

TestClassVariable tstClassVar = new TestClassVariable();

}

end = System.currentTimeMillis();

System.out.println(end – start + ” “

+ “milli seconds execution time”);

}

}

Result: 16 milli seconds execution time

We could easily figure it out the performance get enhance 6 times then the original one