[Contents] [Prev] [Next] [Index]
Contents
- Preface
Part I: Strategies
- 1 What is Performance?
- 1.1 Computational Performance
- 1.2 RAM Footprint
- 1.3 Startup Time
- 1.4 Scalability
- 1.5 Perceived Performance
- 2 The Performance Process
- 2.1 Developing a Performance Process
- 2.1.1 Analysis
- 2.1.2 Object-Oriented Design
- 2.1.3 Coding
- 2.1.4 Testing
- 2.1.5 Profiling
- 2.2 References on Object-Oriented Design
- 3 Measurement is Everything
- 3.1 Benchmarking
- 3.1.1 Why Build Benchmarks?
- 3.1.2 Micro-Benchmarks
- 3.1.3 Macro-Benchmarks
- 3.1.4 Analyzing Benchmarks
- 3.2 Profiling
- 3.2.1 Profiling Execution Times
- 3.2.2 Profiling Memory Usage
- 3.2.3 Profiling to Locate Memory Leaks
- 3.3 Dealing with Flat Profiles
- 3.3.1 A Flat Profile Example
Part II: Tactics
- 4 I/O Performance
- 4.1 Basic I/O
- 4.1.1 Buffered Streams
- 4.1.2 Custom Buffering
- 4.1.3 Further Improvements
- 4.2 Serialization
- 4.2.1 Serialization Example
- 4.2.2 Improved Serialization Example
- 4.2.3 Analyzing Persistent State
- 5 RAM Footprint
- 5.1 Computing RAM Footprint
- 5.1.1 Assessing Memory Usage
- 5.1.2 Measuring a Program's True Footprint
- 5.2 What Contributes to Footprint?
- 5.2.1 Objects
- 5.2.2 Classes
- 5.2.3 Threads
- 5.2.4 Native Data Structures
- 5.2.5 Native Libraries
- 5.3 Class Loading
- 5.3.1 Measuring Class Loads
- 6 Controlling Class Loading
- 6.1 Eager Class Loading
- 6.1.1 Controlling Eager Loading
- 6.2 Reducing the Number of Classes
- 6.2.1 Simple Inner Classes
- 6.2.2 Collapsing the Listeners
- 6.2.3 Using Reflection
- 6.2.4 Using a Proxy
- 6.2.5 Who Really Uses These Tactics?
- 6.3 Running Multiple Programs
- 6.3.1 The Office Suite
- 6.3.2 Running in the Same Virtual Machine
- 6.3.3 A Better Launcher
- 7 Object Mutability: String and Other Things
- 7.1 Lots of Little Objects
- 7.2 Handling String Objects
- 7.3 Mutable Objects in AWT and Swing
- 7.3.1 Eliminating Temporary Objects
- 7.4 Other Mutable Object Tactics
- 7.4.1 Simulating const
- 7.5 Mutable Object Case Study
- 7.6 Small Objects and the Modern JVM
- 7.6.1 Object Pooling
- 7.7 Array Mutability
- 8 Algorithms and Data Structures
- 8.1 Selecting Algorithms
- 8.1.1 Comparing Algorithms
- 8.1.2 Achieving Elegance
- 8.1.3 Considering the Problem Space
- 8.2 Using Recursive Algorithms
- 8.3 Beyond Simple Algorithms
- 8.4 Selecting Data Structures
- 8.4.1 Java 2 Collections
- 8.4.2 The Collection Interfaces
- 8.4.3 Collection Interface
- 8.4.4 List Objects
- 8.4.5 Set Objects
- 8.4.6 Map Objects
- 8.4.7 Synchronized Collections
- 8.4.8 Collections Framework Algorithms
- 8.4.9 Plain Arrays
- 8.4.10 Immutable Collections
- 8.5 Collections Example
- 8.5.1 Collection Benchmark Results
- 8.6 References on Algorithms and Data Structures
- 9 Using Native Code
- 9.1 Native Graphics Example
- 9.1.1 Native Code Comparison
- 9.2 Examining JNI Costs
- 9.2.1 Java Language Copy
- 9.2.2 JNI Patterns
- 9.2.3 Pattern 1: Call
- 9.2.4 Pattern 2: Call-Pull
- 9.2.5 Pattern 3: Call-Pull-Push
- 9.2.6 Pattern 3 (Variant): Call-Pull-Push with Critical
- 9.2.7 Pattern 4: Call-Invoke
- 9.3 Native Code Case Studies
- 9.3.1 Java Media Framework
- 9.3.2 The java.math Package
- 9.3.3 Java 3D
- 10 Swing Models and Renderers
- 10.1 Swing's Component Architecture
- 10.2 Scalable Components
- 10.2.1 Renderers
- 10.2.2 Models
- 10.2.3 Example: Simple Spreadsheet
- 10.2.4 Using Custom Models
- 10.2.5 Using Custom Renderers
- 10.2.6 Using Custom Models and Renderers Together
- 11 Writing Responsive User Interfaces with Swing
- 11.1 Guidelines for Responsive GUIs
- 11.1.1 Design, Then Build (Repeat)
- 11.1.2 Put the User in Charge
- 11.2 Using Threads in Swing Programs
- 11.2.1 The Single-Thread Rule
- 11.2.2 Using invokeLater and invokeAndWait for Event Dispatching
- 11.3 Using Timers in Swing Applications
- 11.3.1 How Timers Work
- 11.3.2 Code Without Timers
- 11.3.3 The Swing Timer Class
- 11.3.4 The Utility Timer and TimerTask Classes
- 11.3.5 How to Choose a Timer Class
- 11.3.6 Timer Example
- 11.4 Responsive Applications Use Threads
- 11.5 Example: Searching the Web
- 11.5.1 Worker Thread Priority
- 11.5.2 Interrupting a Worker Thread
- 12 Deployment
- 12.1 Compiler Options
- 12.2 JAR Files
- 12.2.1 Reducing Program Size
- 12.2.2 Download Time Reduction
- 12.2.3 JAR Files and Resources
- 12.3 Packaging Utilities
- 12.4 Dynamic Downloading
- 12.4.1 Applet Caching
Appendices 191
- A The Truth About Garbage Collection
- A.1 Why Should You Care About Garbage Collection?
- A.2 The Guarantees of GC
- A.3 The Object Lifecycle
- A.31 Created
- A.32 In Use
- A.33 Invisible
- A.34 Unreachable
- A.35 Collected
- A.36 Finalized
- A.37 Deallocated
- A.4 Reference Objects
- A.41 Types of Reference Objects
- A.42 Example GC with WeakReference
- A.5 References on Garbage Collection
- B The Java HotSpot Virtual Machine
- B.1 HotSpot Architecture
- B.11 Two Versions of HotSpot
- B.2 Runtime Features
- B.21 Memory Allocation and Garbage Collection
- B.22 Thread Synchronization
- B.3 HotSpot Server Compiler
- B.31 Aggressive Inlining
- B.32 Other Optimizations
- B.33 Array Bounds Checks
- B.4 -X Flags
- B.41 -Xnoclassgc
- B.42 -Xincgc
- B.43 -Xbatch
- B.44 -Xms
- B.45 -Xmx
- B.46 -Xprof
- B.5 -XX Flags
- B.51 Kinds of -XX Flags
- B.52 PrintBytecodeHistogram
- B.53 CompileThreshold
- B.54 NewSize
- References
- Index
[Contents] [Prev] [Next] [Index]
Copyright © 2001, Sun Microsystems,Inc.. All rights
reserved.