Many of us passes through the same situation of having a low performance of our application. But if you follow some of the tips and tricks below you will soon realize the increase in the performance.
Collections
Always assign size to ArrayLists and other collections. Ex:
Strings
Always use
JDBC
Always close these statements after use: <
JSP
Use session object as compared to hidden values, url rewriting and cookies Use
Collections
Always assign size to ArrayLists and other collections. Ex:
Collection c = new ArrayList(10);
Strings
Always use
String abc = "I love Java";instead of String abc = new String("I love Java");
JDBC
Always close these statements after use: <
Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnection("databaseUrl","username","password"); Statement stmt = conn.createStatement(); String strSql = "select * from abc"; ResultSet rs = stmt.executeQuery("strSql");// close these stmt.close(); rs.close(); conn.close(); strSql=null;Use only the required columns in select query:
Select FIRSTNAME,LASTNAME from PERSON;instead of
Select * from Person;
JSP
Use session object as compared to hidden values, url rewriting and cookies Use
System.out.print()instead of
System.out.println();wherever necessary
Comments
Post a Comment