Problem Solving in Data Structures & Algorithms Using Java
Annotation
957
115
3MB
English
Year 2018
Report DMCA / Copyright
DOWNLOAD EPUB FILE
Table of contents :
Why Is It Slow? 2 --
The Tuning Game 3 --
System Limitations and What to Tune 3 --
A Tuning Strategy 5 --
Perceived Performance 6 --
Starting to Tune 10 --
What to Measure 15 --
Don't Tune What You Don't Need to Tune 16 --
2. Profiling Tools 19 --
Measurements and Timings 20 --
Garbage Collection 22 --
Method Calls 27 --
Object-Creation Profiling 43 --
Monitoring Gross Memory Usage 51 --
Client/Server Communications 56 --
3. Underlying JDK Improvements 64 --
Garbage Collection 64 --
Tuning the Heap 66 --
Gross Tuning 66 --
Fine-Tuning the Heap 68 --
Sharing Memory 72 --
Replacing JDK Classes 72 --
Faster VMs 75 --
Better Optimizing Compilers 79 --
Sun's Compiler and Runtime Optimizations 88 --
Compile to Native Machine Code 94 --
Native Method Calls 95 --
Uncompressed ZIP/JAR Files 97 --
4. Object Creation 100 --
Object-Creation Statistics 101 --
Object Reuse 102 --
Reference Objects 115 --
Avoiding Garbage Collection 122 --
Initialization 125 --
Early and Late Initialization 126 --
5. Strings 131 --
The Performance Effects of Strings 131 --
Compile-Time Versus Runtime Resolution of Strings 134 --
Conversions to Strings 135 --
Strings Versus char Arrays 150 --
String Comparisons and Searches 162 --
Sorting Internationalized Strings 164 --
6. Exceptions, Assertions, Casts, and Variables 172 --
Exceptions 172 --
Assertions 177 --
Casts 182 --
Variables 184 --
Method Parameters 187 --
7. Loops, Swiches, and Recursion 190 --
Loops 190 --
Tuning a Loop 194 --
Exception-Terminated Loops 201 --
Switches 205 --
Recursion 211 --
Recursion and Stacks 215 --
8. I/O, Logging, and Console Output 219 --
Replacing System.out 221 --
Logging 223 --
From Raw I/O to Smokin' I/O 224 --
Serialization 233 --
Clustering Objects and Counting I/O Operations 245 --
Compression 247 --
NIO 249 --
9. Sorting 260 --
Avoiding Unnecessary Sorting Overhead 260 --
An Efficient Sorting Framework 263 --
Better Than O(nlogn) Sorting 271 --
10. Threading 278 --
User-Interface Thread and Other Threads 279 --
Race Conditions 281 --
Deadlocks 282 --
Synchronization Overhead 285 --
Timing Multithreaded Tests 295 --
Atomic Access and Assignment 296 --
Thread Pools 299 --
Load Balancing 301 --
Threaded Problem-Solving Strategies 312 --
11. Appropriate Data Structures and Algorithms 314 --
Collections 315 --
Java 2 Collections 317 --
Hashtables and HashMaps 320 --
Optimizing Queries 323 --
Comparing LinkedLists and ArrayLists 327 --
The RandomAccess Interface 333 --
Cached Access 337 --
Caching Examples 338 --
Finding the Index for Partially Matched Strings 344 --
Search Trees 348 --
12. Distributed Computing 367 --
Tools 369 --
Message Reduction 371 --
Comparing Communications Layers 374 --
Caching 375 --
Batching I 377 --
Application Partitioning 378 --
Batching II 379 --
Low-Level Communication Optimizations 380 --
Distributed Garbage Collection 385 --
Databases 385 --
Web Services 386 --
13. When to Optimize 395 --
When Not to Optimize 396 --
Tuning Class Libraries and Beans 396 --
Analysis 399 --
Design and Architecture 403 --
Tuning After Deployment 418 --
More Factors That Affect Performance 420 --
Performance Planning 422 --
14. Underlying Operating System and Network Improvements 429 --
Hard Disks 430 --
CPU 435 --
RAM 436 --
Network I/O 438 --
15. J2EE Performance Tuning 445 --
Performance Planning 445 --
J2EE Monitoring and Profiling Tools 445 --
Measurements: What, Where, and How 447 --
Load Testing 451 --
User Perception 452 --
Clustering and Load Balancing 455 --
Tuning JMS 459 --
16. Tuning JDBC 463 --
Measuring JDBC Performance 463 --
Tuning JDBC 474 --
17. Tuning Servlets and JSPs 501 --
Don't Use Single Thread Model 501 --
Efficient Page Creation and Output 502 --
Body Tags 505 --
Cache Tags 506 --
HttpSession 506 --
Compression 509 --
More Performance Tips 511 --
Case Study: Ace's Hardware SPECmine Tool 512 --
18. Tuning EJBs 516 --
Primary Design Guidelines 516 --
Performance-Optimizing Design Patterns 521 --
The Application Server 525 --
More Suggestions for Tuning EJBs 529 --
Case Study: The Pet Store 529 --
Case Study: Elite.com 530.