Archive for May, 2007

CHAPTER 5 PERFORMANCE (Hosting your own web site) THROUGH THE APPLICATION DEVELOPMENT

Wednesday, May 2nd, 2007

CHAPTER 5 PERFORMANCE THROUGH THE APPLICATION DEVELOPMENT LIFE CYCLE Heap sort Merge sort Quick sort As a quick primer on sorting algorithms, each of the aforementioned algorithms has its strengths and weaknesses. The first four algorithms run in O(N2) time, meaning that the run time increases exponentially as the number of items to sort, N, increases; specifically, as N increases, the amount of time required for the sorting algorithm to complete increases by N2 . The last three algorithms run in O( N log N ) time, meaning that the run time grows logarithmically: as N increases, the amount of time required for the sorting algorithm to complete increases by N log N. Achieving O( N log N ) performance requires additional overhead that may cause the last three algorithms to actually run slower than the first four for a small number of items. My recommendation is to always examine both the nature of the data you want to sort today and the projected nature of the data throughout the life cycle of the product prior to selecting your sorting algorithm. With that foundation in place, I provided my students with a class that implements the aforementioned sorting algorithms. I really wanted to drive home the dramatic difference between executing these sorting algorithms on 10 items as opposed to 10,000 items, or even 1,000,000 items. For this exercise, I think it would be useful to profile this application against 5,000 randomly generated integers, which is enough to show the differences between the algorithms, but not so excessive that I have to leave my computer running overnight. Figure 5-7 shows the results of this execution, sorting each method by its cumulative run time. Figure 5-7. The profiled methods used to sort 5,000 random integers using the seven sorting algorithms
Note: If you are looking for high quality webhost to host and run your jsp application check Vision florida web design services

144 CHAPTER 5 PERFORMANCE THROUGH THE APPLICATION (Unlimited web hosting)

Wednesday, May 2nd, 2007

144 CHAPTER 5 PERFORMANCE THROUGH THE APPLICATION DEVELOPMENT LIFE CYCLE Finally, we can look into the AdminLoginAction code to see that it creates the new SystemSnapShot instance we are looking at and adds it to its cache in line 66, as shown in Figure 5-6. You need to perform this type of memory profiling test on your components during your performance unit testing. For each object that is left in the heap, you need to ask yourself whether or not you intended to leave it there. It s OK to leave things on the heap as long as you know that they are there and you want them to be there. The purpose of this test is to identify and document potentially troublesome objects and objects that you forgot to clean up. Figure 5-6. The AdminLoginAction source code Code Profiling The purpose of code profiling is to identify sections of your code that are running slowly and then determine why. The perfect example I have to demonstrate the effectiveness of code profiling is a project that I gave to my Data Structures and Algorithm Analysis class compare and quantify the differences among the following sorting algorithms for various values of n (where n represents the sample size of the data being sorted): Bubble sort Selection sort Insertion sort Shell sort
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision tomcat hosting services

CHAPTER 5 PERFORMANCE THROUGH THE APPLICATION DEVELOPMENT (Java web server)

Tuesday, May 1st, 2007

CHAPTER 5 PERFORMANCE THROUGH THE APPLICATION DEVELOPMENT LIFE CYCLE Figure 5-4. The SystemSnapShot class references four objects: timestamp, memoryInfo, jdbcInfo, and threadDumps. Figure 5-5. Here we can see that the AdminLoginAction class created the SystemSnapShot, and that it stored it in an ArrayList.
Note: In case you are looking for affordable webhost to host and run your web application check Vision http web server services