Java™ Performance Tuning, 2Nd Edition by Jack Shirazi

Total Page:16

File Type:pdf, Size:1020Kb

Java™ Performance Tuning, 2Nd Edition by Jack Shirazi [ Team LiB ] • Table of Contents • Index • Reviews • Examples • Reader Reviews • Errata Java™ Performance Tuning, 2nd Edition By Jack Shirazi Publisher : O'Reilly Pub Date : January 2003 ISBN : 0-596-00377-3 Pages : 588 Java Peformance Tuning, 2nd edition provides a comprehensive and indispensable guide to eliminating all types of performance problems. Using many real-life examples to work through the tuning process in detail, JPT shows how tricks such as minimizing object creation and replacing strings with arrays can really pay off in improving your code's performance. Tuning J2EE applications bears many similarities to tuning J2SE apps, but important and specific considerations apply. For this reason, Java Performance Tuning, Second Edition includes four new chapters: a new chapter on J2EE application tuning in general followed by chapters on tuning JDBC, servlets and JSPs, and EJBs. [ Team LiB ] • Table of Contents • Index • Reviews • Examples • Reader Reviews • Errata Java™ Performance Tuning, 2nd Edition By Jack Shirazi Publisher : O'Reilly Pub Date : January 2003 ISBN : 0-596-00377-3 Pages : 588 Copyright Preface Contents of This Book New in the Second Edition Virtual Machine (VM) Versions Conventions Used in This Book Comments and Questions Acknowledgments Chapter 1. Introduction Section 1.1. Why Is It Slow? Section 1.2. The Tuning Game Section 1.3. System Limitations and What to Tune Section 1.4. A Tuning Strategy Section 1.5. Perceived Performance Section 1.6. Starting to Tune Section 1.7. What to Measure Section 1.8. Don't Tune What You Don't Need to Tune Section 1.9. Performance Checklist Chapter 2. Profiling Tools Section 2.1. Measurements and Timings Section 2.2. Garbage Collection Section 2.3. Method Calls Section 2.4. Object-Creation Profiling Section 2.5. Monitoring Gross Memory Usage Section 2.6. Client/Server Communications Section 2.7. Performance Checklist Chapter 3. Underlying JDK Improvements Section 3.1. Garbage Collection Section 3.2. Tuning the Heap Section 3.3. Gross Tuning Section 3.4. Fine-Tuning the Heap Section 3.5. Sharing Memory Section 3.6. Replacing JDK Classes Section 3.7. Faster VMs Section 3.8. Better Optimizing Compilers Section 3.9. Sun's Compiler and Runtime Optimizations Section 3.10. Compile to Native Machine Code Section 3.11. Native Method Calls Section 3.12. Uncompressed ZIP/JAR Files Section 3.13. Performance Checklist Chapter 4. Object Creation Section 4.1. Object-Creation Statistics Section 4.2. Object Reuse Section 4.3. Reference Objects Section 4.4. Avoiding Garbage Collection Section 4.5. Initialization Section 4.6. Early and Late Initialization Section 4.7. Performance Checklist Chapter 5. Strings Section 5.1. The Performance Effects of Strings Section 5.2. Compile-Time Versus Runtime Resolution of Strings Section 5.3. Conversions to Strings Section 5.4. Strings Versus char Arrays Section 5.5. String Comparisons and Searches Section 5.6. Sorting Internationalized Strings Section 5.7. Performance Checklist Chapter 6. Exceptions, Assertions, Casts, and Variables Section 6.1. Exceptions Section 6.2. Assertions Section 6.3. Casts Section 6.4. Variables Section 6.5. Method Parameters Section 6.6. Performance Checklist Chapter 7. Loops, Switches, and Recursion Section 7.1. Loops Section 7.2. Tuning a Loop Section 7.3. Exception-Terminated Loops Section 7.4. Switches Section 7.5. Recursion Section 7.6. Recursion and Stacks Section 7.7. Performance Checklist Chapter 8. I/O, Logging, and Console Output Section 8.1. Replacing System.out Section 8.2. Logging Section 8.3. From Raw I/O to Smokin' I/O Section 8.4. Serialization Section 8.5. Clustering Objects and Counting I/O Operations Section 8.6. Compression Section 8.7. NIO Section 8.8. Performance Checklist Chapter 9. Sorting Section 9.1. Avoiding Unnecessary Sorting Overhead Section 9.2. An Efficient Sorting Framework Section 9.3. Better Than O(nlogn) Sorting Section 9.4. Performance Checklist Chapter 10. Threading Section 10.1. User-Interface Thread and Other Threads Section 10.2. Race Conditions Section 10.3. Deadlocks Section 10.4. Synchronization Overhead Section 10.5. Timing Multithreaded Tests Section 10.6. Atomic Access and Assignment Section 10.7. Thread Pools Section 10.8. Load Balancing Section 10.9. Threaded Problem-Solving Strategies Section 10.10. Performance Checklist Chapter 11. Appropriate Data Structures and Algorithms Section 11.1. Collections Section 11.2. Java 2 Collections Section 11.3. Hashtables and HashMaps Section 11.4. Optimizing Queries Section 11.5. Comparing LinkedLists and ArrayLists Section 11.6. The RandomAccess Interface Section 11.7. Cached Access Section 11.8. Caching Examples Section 11.9. Finding the Index for Partially Matched Strings Section 11.10. Search Trees Section 11.11. Performance Checklist Chapter 12. Distributed Computing Section 12.1. Tools Section 12.2. Message Reduction Section 12.3. Comparing Communications Layers Section 12.4. Caching Section 12.5. Batching I Section 12.6. Application Partitioning Section 12.7. Batching II Section 12.8. Low-Level Communication Optimizations Section 12.9. Distributed Garbage Collection Section 12.10. Databases Section 12.11. Web Services Section 12.12. Performance Checklist Chapter 13. When to Optimize Section 13.1. When Not to Optimize Section 13.2. Tuning Class Libraries and Beans Section 13.3. Analysis Section 13.4. Design and Architecture Section 13.5. Tuning After Deployment Section 13.6. More Factors That Affect Performance Section 13.7. Performance Planning Section 13.8. Performance Checklist Chapter 14. Underlying Operating System and Network Improvements Section 14.1. Hard Disks Section 14.2. CPU Section 14.3. RAM Section 14.4. Network I/O Section 14.5. Performance Checklist Chapter 15. J2EE Performance Tuning Section 15.1. Performance Planning Section 15.2. J2EE Monitoring and Profiling Tools Section 15.3. Measurements: What, Where, and How Section 15.4. Load Testing Section 15.5. User Perception Section 15.6. Clustering and Load Balancing Section 15.7. Tuning JMS Section 15.8. Performance Checklist Chapter 16. Tuning JDBC Section 16.1. Measuring JDBC Performance Section 16.2. Tuning JDBC Section 16.3. Performance Checklist Chapter 17. Tuning Servlets and JSPs Section 17.1. Don't Use SingleThreadModel Section 17.2. Efficient Page Creation and Output Section 17.3. Body Tags Section 17.4. Cache Tags Section 17.5. HttpSession Section 17.6. Compression Section 17.7. More Performance Tips Section 17.8. Case Study: Ace's Hardware SPECmine Tool Section 17.9. Performance Checklist Chapter 18. Tuning EJBs Section 18.1. Primary Design Guidelines Section 18.2. Performance-Optimizing Design Patterns Section 18.3. The Application Server Section 18.4. More Suggestions for Tuning EJBs Section 18.5. Case Study: The Pet Store Section 18.6. Case Study: Elite.com Section 18.7. Performance Checklist Chapter 19. Further Resources Section 19.1. The Primary Resource Section 19.2. Books Section 19.3. Magazines Section 19.4. URLs Section 19.5. Profilers Section 19.6. Optimizers Colophon Index [ Team LiB ] Copyright Copyright © 2003, 2000 O'Reilly & Associates, Inc. Printed in the United States of America. Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O'Reilly & Associates books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safari.oreilly.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly & Associates, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. The association between the image of a serval and the topic of Java performance tuning is a trademark of O'Reilly & Associates, Inc. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other countries. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. [ Team LiB ] Preface Performance has been an important issue with Java™ since the first version hit the Web years ago. Making those first interpreted programs run fast enough was a huge challenge for many developers. Since then, Java performance has improved enormously, and any Java program can now be made to run fast enough provided you avoid the main performance pitfalls. This book provides all the details a developer needs to performance-tune any type of Java program. I give step-by-step instructions on all aspects of the performance-tuning process, from early considerations such as setting goals, measuring performance, and choosing a compiler, to detailed examples on using profiling tools and applying the results to tune the code. This is not an entry-level book about Java, but you do not need any previous tuning knowledge to benefit from reading it. Many of the tuning techniques presented in this book lead to an increased maintenance cost, so they should not be applied arbitrarily. Change your code only when a bottleneck has been identified, and never change the design of your application for minor performance gains. [ Team LiB ] Contents of This Book Chapter 1 gives general guidelines on how to tune. If you do not yet have a tuning strategy, this chapter provides a methodical tuning process. Chapter 2 covers the tools you need to use while tuning. Chapter 3 looks at the SDK, including Virtual Machines (VMs) and compilers.
Recommended publications
  • An Efficient Evolutionary Algorithm for Solving Incrementally Structured
    An Efficient Evolutionary Algorithm for Solving Incrementally Structured Problems Jason Ansel Maciej Pacula Saman Amarasinghe Una-May O'Reilly MIT - CSAIL July 14, 2011 Jason Ansel (MIT) PetaBricks July 14, 2011 1 / 30 Our goal is to make programs run faster We use evolutionary algorithms to search for faster programs The PetaBricks language defines search spaces of algorithmic choices Who are we? I do research in programming languages (PL) and compilers The PetaBricks language is a collaboration between: A PL / compiler research group A evolutionary algorithms research group A applied mathematics research group Jason Ansel (MIT) PetaBricks July 14, 2011 2 / 30 The PetaBricks language defines search spaces of algorithmic choices Who are we? I do research in programming languages (PL) and compilers The PetaBricks language is a collaboration between: A PL / compiler research group A evolutionary algorithms research group A applied mathematics research group Our goal is to make programs run faster We use evolutionary algorithms to search for faster programs Jason Ansel (MIT) PetaBricks July 14, 2011 2 / 30 Who are we? I do research in programming languages (PL) and compilers The PetaBricks language is a collaboration between: A PL / compiler research group A evolutionary algorithms research group A applied mathematics research group Our goal is to make programs run faster We use evolutionary algorithms to search for faster programs The PetaBricks language defines search spaces of algorithmic choices Jason Ansel (MIT) PetaBricks July 14, 2011
    [Show full text]
  • Sorting Algorithm 1 Sorting Algorithm
    Sorting algorithm 1 Sorting algorithm In computer science, a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) that require sorted lists to work correctly; it is also often useful for canonicalizing data and for producing human-readable output. More formally, the output must satisfy two conditions: 1. The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order); 2. The output is a permutation, or reordering, of the input. Since the dawn of computing, the sorting problem has attracted a great deal of research, perhaps due to the complexity of solving it efficiently despite its simple, familiar statement. For example, bubble sort was analyzed as early as 1956.[1] Although many consider it a solved problem, useful new sorting algorithms are still being invented (for example, library sort was first published in 2004). Sorting algorithms are prevalent in introductory computer science classes, where the abundance of algorithms for the problem provides a gentle introduction to a variety of core algorithm concepts, such as big O notation, divide and conquer algorithms, data structures, randomized algorithms, best, worst and average case analysis, time-space tradeoffs, and lower bounds. Classification Sorting algorithms used in computer science are often classified by: • Computational complexity (worst, average and best behaviour) of element comparisons in terms of the size of the list . For typical sorting algorithms good behavior is and bad behavior is .
    [Show full text]
  • How to Sort out Your Life in O(N) Time
    How to sort out your life in O(n) time arel Číže @kaja47K funkcionaklne.cz I said, "Kiss me, you're beautiful - These are truly the last days" Godspeed You! Black Emperor, The Dead Flag Blues Everyone, deep in their hearts, is waiting for the end of the world to come. Haruki Murakami, 1Q84 ... Free lunch 1965 – 2022 Cramming More Components onto Integrated Circuits http://www.cs.utexas.edu/~fussell/courses/cs352h/papers/moore.pdf He pays his staff in junk. William S. Burroughs, Naked Lunch Sorting? quicksort and chill HS 1964 QS 1959 MS 1945 RS 1887 quicksort, mergesort, heapsort, radix sort, multi- way merge sort, samplesort, insertion sort, selection sort, library sort, counting sort, bucketsort, bitonic merge sort, Batcher odd-even sort, odd–even transposition sort, radix quick sort, radix merge sort*, burst sort binary search tree, B-tree, R-tree, VP tree, trie, log-structured merge tree, skip list, YOLO tree* vs. hashing Robin Hood hashing https://cs.uwaterloo.ca/research/tr/1986/CS-86-14.pdf xs.sorted.take(k) (take (sort xs) k) qsort(lotOfIntegers) It may be the wrong decision, but fuck it, it's mine. (Mark Z. Danielewski, House of Leaves) I tell you, my man, this is the American Dream in action! We’d be fools not to ride this strange torpedo all the way out to the end. (HST, FALILV) Linear time sorting? I owe the discovery of Uqbar to the conjunction of a mirror and an Encyclopedia. (Jorge Luis Borges, Tlön, Uqbar, Orbis Tertius) Sorting out graph processing https://github.com/frankmcsherry/blog/blob/master/posts/2015-08-15.md Radix Sort Revisited http://www.codercorner.com/RadixSortRevisited.htm Sketchy radix sort https://github.com/kaja47/sketches (thinking|drinking|WTF)* I know they accuse me of arrogance, and perhaps misanthropy, and perhaps of madness.
    [Show full text]
  • Sorting Algorithm 1 Sorting Algorithm
    Sorting algorithm 1 Sorting algorithm A sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists; it is also often useful for canonicalizing data and for producing human-readable output. More formally, the output must satisfy two conditions: 1. The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order); 2. The output is a permutation (reordering) of the input. Since the dawn of computing, the sorting problem has attracted a great deal of research, perhaps due to the complexity of solving it efficiently despite its simple, familiar statement. For example, bubble sort was analyzed as early as 1956.[1] Although many consider it a solved problem, useful new sorting algorithms are still being invented (for example, library sort was first published in 2006). Sorting algorithms are prevalent in introductory computer science classes, where the abundance of algorithms for the problem provides a gentle introduction to a variety of core algorithm concepts, such as big O notation, divide and conquer algorithms, data structures, randomized algorithms, best, worst and average case analysis, time-space tradeoffs, and upper and lower bounds. Classification Sorting algorithms are often classified by: • Computational complexity (worst, average and best behavior) of element comparisons in terms of the size of the list (n). For typical serial sorting algorithms good behavior is O(n log n), with parallel sort in O(log2 n), and bad behavior is O(n2).
    [Show full text]
  • STUDY of NON-COMPARISON SORTING ALGORITHMS By
    STUDY OF NON-COMPARISON SORTING ALGORITHMS By ZHIMINMA Bachelor of Science Beijing University of Aeronautics & Astronauntics Beijing, P.R.China 1990 Suhmitted to the Faculty of the Graduate College of the Oklahoma State University In partial fulfillment of the requirements for the Degree of MASTER OF SCIENCE May, 2000 • STUDY OF NON-COMPARISON SORTING ALGORITHMS Thesis Approved: Uay11R.) 13. foudi. Dean of the Graduate College II PREFACE The primary purpose of this project is to compare two new non-comparison sorting algorithms: Groupsort and Flashsort 1. To simplify discussion, we focus on the performance of these algorithms with integer data. First, we test Groupsort and Flashsort1 against bucket sort using uniformly distributed integer values with a number of different additional storage spaces and give run time performance curves. Then, we test Groupsort and Flashsortl against Quicksort using different distributed input data and give run time perfomance curves. Through the analysis of impact of run time, additional storage space, and data distribution, an optimal method is given to make each algonthm perform well. I sincerely thank my M.S. Committee - Drs. J. P. Chandler. G. L. Ikdnck, and B. E. Mayfield --- for guidance and support in the completion or this research. III ACKNOWLEDGMENTS I wish to express my sincere appreciation to my advisor, Dr. J. P. Chandler, for his intelligent supervision, constructive guidance, and inspiration, My sincere appreciation extends to my other committee members Dr. G. E. Hedrick, and Dr. B. E. Mayfield, whose guidance, assistance, and encouragement were also invaluable. 1would like to give my special appreciation to my parents Mr.
    [Show full text]
  • Adaptive and Secured Resource Management in Distributed and Internet Systems
    W&M ScholarWorks Dissertations, Theses, and Masters Projects Theses, Dissertations, & Master Projects 2002 Adaptive and secured resource management in distributed and Internet systems Li Xiao College of William & Mary - Arts & Sciences Follow this and additional works at: https://scholarworks.wm.edu/etd Part of the Computer Sciences Commons Recommended Citation Xiao, Li, "Adaptive and secured resource management in distributed and Internet systems" (2002). Dissertations, Theses, and Masters Projects. Paper 1539623406. https://dx.doi.org/doi:10.21220/s2-deqc-ew25 This Dissertation is brought to you for free and open access by the Theses, Dissertations, & Master Projects at W&M ScholarWorks. It has been accepted for inclusion in Dissertations, Theses, and Masters Projects by an authorized administrator of W&M ScholarWorks. For more information, please contact [email protected]. Reproduced with with permission permission of the of copyright the copyright owner. owner.Further reproductionFurther reproduction prohibited without prohibited permission. without permission. Adaptive and Secured Resource Management in Distributed and Internet Systems A Dissertation Presented to The Faculty of the Department of Computer Science The College of William & Mary in Virginia In Partial Fulfillment Of the Requirements for the Degree of Doctor of Philosophy by Li Xiao 2002 Reproduced with permission of the copyright owner. Further reproduction prohibited without permission. APPROVAL SHEET Tliis dissertation is submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy .JU Li Xiao Approved. July 2002 Thesis Advisor V)JjU^ 'I William L. Bvmun ' Phil Kearns c/C'-vX ^ A^ Robert E. Noonan Marc Slier Department of Physics Reproduced with permission of the copyright owner.
    [Show full text]
  • Engineering Cache-Oblivious Sorting Algorithms
    Engineering Cache-Oblivious Sorting Algorithms Master’s Thesis by Kristoffer Vinther June 2003 Abstract Modern computers are far more sophisticated than simple sequential programs can lead one to believe; instructions are not executed sequentially and in constant time. In particular, the memory of a modern computer is structured in a hierarchy of increasingly slower, cheaper, and larger storage. Accessing words in the lower, faster levels of this hierarchy can be done virtually immediately, but accessing the upper levels may cause delays of millions of processor cycles. Consequently, recent developments in algorithm design have had a focus on developing algorithms that sought to minimize accesses to the higher levels of the hierarchy. Much experimental work has been done showing that using these algorithms can lead to higher performing algorithms. However, these algorithms are designed and implemented with a very specific level in mind, making it infeasible to adapt them to multiple levels or use them efficiently on different architectures. To alleviate this, the notion of cache-oblivious algorithms was developed. The goal of a cache-oblivious algorithm is to be optimal in the use of the memory hierarchy, but without using specific knowledge of its structure. This automatically makes the algorithm efficient on all levels of the hierarchy and on all implementations of such hierarchies. The experimental work done with these types of algorithms remain sparse, however. In this thesis, we present a thorough theoretical and experimental analysis of known optimal cache-oblivious sorting algorithms. We develop our own simpler variants and present the first optimal sub-linear working space cache-oblivious sorting algorithm.
    [Show full text]
  • Implementations of Randomized Sorting on Large Parallel Machines
    Implementations of Randomized Sorting on Large Parallel Machines (Preliminary Version) William L. Hightower Jan F. Prins† John H. Reif‡ Elon College University of North Carolina Duke University Elon College NC 27244 Chapel Hill NC 27599-3175 Durham NC 27706 Abstract 1. Introduction Flashsort [RV83,86] and Samplesort [HC83] are Considerable effort has been made by the theoretical related parallel sorting algorithms proposed in the literature. community in the design of parallel algorithms with Both utilize a sophisticated randomized sampling technique excellent and sometimes optimal asymptotic efficiency. to form a splitter set, but Samplesort distributes the splitter However, the field has had less success in demonstrating the set to each processor while Flashsort uses splitter-directed utility of these algorithms by actual implementations. routing. Ideally, the analysis of parallel algorithms should proceed In this paper we present B-Flashsort, a new beyond asymptotic efficiency and be extended to the level of batched-routing variant of Flashsort designed to sort N>P implementations. In practice, this is difficult to do. values using P processors connected in a d-dimensional mesh and using constant space in addition to the input and For one thing, the relation between the asymptotic output. The key advantage of the Flashsort approach over complexity of an algorithm and the performance of an Samplesort is a decrease in memory requirements, by implementation can be considerably more complex for avoiding the broadcast of the splitter set to all processors. implementations of parallel algorithms than for sequential The practical advantage of B-Flashsort over Flashsort is that algorithms. For example, the number of processors or the it replaces pipelined splitter-directed routing with a set of amount of memory available to a processor in existing synchronous local communications and bounds recursion, machines can easily be reached well before the while still being demonstrably efficient.
    [Show full text]
  • In Search of the Fastest Sorting Algorithm
    In Search of the Fastest Sorting Algorithm Emmanuel Attard Cassar [email protected] Abstract: This paper explores in a chronological way the concepts, structures, and algorithms that programmers and computer scientists have tried out in their attempt to produce and improve the process of sorting. The measure of ‘fastness’ in this paper is mainly given in terms of the Big O notation. Keywords: sorting, algorithms orting is an extremely useful procedure in our information-laden society. Robert Sedgewick and Kevin Wayne have this to say: ‘In Sthe early days of computing, the common wisdom was that up to 30 per cent of all computing cycles was spent sorting. If that fraction is lower today, one likely reason is that sorting algorithms are relatively efficient, not that sorting has diminished in relative importance.’1 Many computer scientists consider sorting to be the most fundamental problem in the study of algorithms.2 In the literature, sorting is mentioned as far back as the seventh century BCE where the king of Assyria sorted clay tablets for the royal library according to their shape.3 1 R. Sedgewick, K. Wayne, Algorithms, 4th edn. (USA, 2011), Kindle Edition, Locations 4890-4892. 2 T.H. Cormen, C.E. Leiserson, R.L. Rivest, C. Stein, Introduction to Algorithms, 3rd edn. (USA, 2009), 148. 3 N. Akhter, M. Idrees, Furqan-ur-Rehman, ‘Sorting Algorithms – A Comparative Study’, International Journal of Computer Science and Information Security, Vol. 14, No. 12, (2016), 930. Symposia Melitensia Number 14 (2018) SYMPOSIA MELITENSIA NUMBER 14 (2018) Premise My considerations will be limited to algorithms on the standard von Neumann computer.
    [Show full text]
  • Making a Fast Unstable Sorting Algorithm Stable1
    Making a fast unstable sorting algorithm stable1 Arne Maus, [email protected] Department of Informatics University of Oslo Abstract This paper demonstrates how an unstable in place sorting algorithm, the ALR algorithm, can be made stable by temporary changing the sorting keys during the recursion. At ‘the bottom of the recursion’ all subsequences with equal valued element are then individually sorted with a stable sorting subalgorithm (insertion sort or radix). Later, on backtrack the original keys are restored. This results in a stable sorting of the whole input. Unstable ALR is much faster than Quicksort (which is also unstable). In this paper it is demonstrated that StableALR, which is some 10-30% slower than the original unstable ALR, is still in most cases 20-60% faster than Quicksort. It is also shown to be faster than Flashsort, a new unstable in place, bucket type sorting algorithm. This is demonstrated for five different distributions of integers in a array of length from 50 to 97 million elements. The StableALR sorting algorithm can be extended to sort floating point numbers and strings and make effective use of a multi core CPU.2 Keywords: stable sorting, radix, most significant radix, multi core CPU, Quicksort, Flashsort, ALR. 1. Introduction, sorting algorithms Sorting is maybe the single most important algorithm performed by computers, and certainly one of the most investigated topics in algorithm design. Numerous sorting algorithms have been devised, and the more commonly used are described and analyzed in any standard textbook in algorithms and data structures [Weiss, Aho] or in standard reference works [Knuth, van Leeuwen].
    [Show full text]
  • External Sort in Data Structure with Example
    External Sort In Data Structure With Example Tawie and new Emmit crucified his stutter amuses impound inflexibly. Double-tongued Rad impressed jingoistically while Douglas always waver his eye chromatograph shallowly, he analyzing so evilly. Lexicographical Pate hutches salaciously. Thus it could be implemented, external sort exist, for satisfying conditions of the number of the number of adding one Any particular order as follows the items into the increased capacity in external data structure with a linked list in the heap before the web log file. Such loading and external sort in data structure with example, external sorting algorithms it can answer because all. For production work, I still suggest that you use a database. Many uses external sorting algorithms. The overall solution is found by describing a method to merge two sorted sequences. In the latter case, we copy this run to the appropriate tape. Repeatedly, the smallest item is removed from the selection tree and placed in the output stream, and the next item from the input file is inserted in its place as a leaf in the selection tree. We will do this for the randomized version. Was a run legths as is related data. In applications a gap using the example, the optimal sorting on the numbers from what is internal sorting algorithms are twice as popping the copies the practical. The external sorting. Till now, we saw that sorting is an important term in any database system. Note that in a rooted tree, the root has no parent and all other nodes have a single parent.
    [Show full text]
  • Team[Or] 2001 [X] Java
    Team[oR] 2001 [x] java O’reilly - Java Performance Tuning Java Performance Tuning Copyright © 2000 O'Reilly & Associates, Inc. All rights reserved. Printed in the United States of America. Published by O'Reilly & Associates, Inc., 101 Morris Street, Sebastopol, CA 95472. The O'Reilly logo is a registered trademark of O'Reilly & Associates, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks, and The Java™ Series is a trademark of O'Reilly & Associates, Inc. The association of the image of a serval with the topic of Java™ performance tuning is a trademark of O'Reilly & Associates, Inc. Java™ and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other countries. O'Reilly & Associates, Inc. is independent of Sun Microsystems. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
    [Show full text]