[Contents] [Prev] [Next] [Index]

A

Abstract Window Toolkit. See AWT
Action , 171, 172
ActionEvent , 73
ActionListener , 76
actionPerformed , 71, 165, 172
addItem , 149
Aggressive inlining , 211
alarm , 169
Algorithms
Bresenham's , 110, 129
Collections Framework , 122
comparing , 105
complex , 115
n-squared , 106
order-1 , 104
order-n , 104
recursive , 112
selecting , 103
Allocation
memory , 30, 208
temporary , 90
Analyzing
benchmarks , 25
data from a profiler , 15
performance trends , 21
persistent state , 51
Apache Software Foundation , 24
Apache web server , 185
Apple Computer , 178
Applet
caching , 188
packaging , 186
Applications, distributed , 162
Array
bounds checks , 213
copy , 135
mutability , 99
plain , 122
ArrayList , 119
Assessing memory usage , 53
Average , 26
AWT , 89
mutable objects , 88
utility methods , 167
windowing system , 145

B

Backtrace , 30
BasicBresenham , 112
Bean , 70, 164
Benchmark , 11, 17, 142
analyzing , 25
collections , 123, 125
comparing , 17, 115
copy , 46
embedded , 19
grid drawing , 111
macro , 24
micro , 22, 23
native code , 135
physics simulation , 98
random numbers in , 126
results , 26, 37, 150
tools , 17
Bibliography , 219
bigBang , 85
BigDecimal , 97
BigInteger , 97
Big-oh notation , 104
binarySearch , 122
Bottlenecks , 27, 86
locating , 27
text processing , 86
Bresenham's algorithm , 110, 129
Brute-force solution , 107
Buffered streams , 41
BufferedImage , 108
BufferedInputStream , 42, 52
BufferedOutputStream , 42, 52
Buffering
custom , 44
streams , 42
Bytecodes , 47, 62

C

C programming language , 42, 142, 207
C++ programming language , 31, 92, 207
Caching , 29
class , 59
in a custom renderer , 156
JAR files , 188
objects , 98
CAD , 24
CaffeineMark , 21
Calculating
object size , 57
RAM footprint , 53
Call pattern , 136
Call-Invoke pattern , 141
Call-Pull pattern , 137
Call-Pull-Push pattern , 138
Call-Pull-Push with Critical pattern , 139
Case studies
mutable objects , 97
native code , 142
Cell overhead , 154
CellEditors , 77
Class hierarchy
Collections Framework , 118
java.io , 41
java.lang.ref , 199
Class loading
controlling , 67
dynamic , 187, 212
eager , 67
issues , 65
measuring , 64
Classes, reducing the number of , 70
Code
compiled , 62, 212
elegant , 106
reuse , 145
Codec , 142
Coding phase , 14
Collapsing listeners , 72
Collected state , 198
Collection , 124
Collections
benchmark , 125
example , 123
Framework , 13, 100
algorithms , 122
hierarchy , 118
immutable , 123
interfaces , 117
synchronized , 120
wrapper-synchronized , 121
Comparing algorithms , 105
Compilation, dynamic , 191, 205
Compiled code , 62, 212
Compiler options , 183
CompileThreshold , 217
Complex
algorithms , 115
datasets , 152
Component
architecture , 145, 146
data , 89
objects , 166
Computational performance , 4, 70, 211
Concentrator , 164
Concurrent access , 169
Considering the problem space , 107
const
keyword , 91, 92, 96
pattern , 91
Constant pool entries , 63
Constructing a GUI in the main thread , 166
Controlling class loading , 67, 69
Copy
array , 136
overhead , 123
CurrentTimeMillis , 18
Custom
buffering , 44
model , 152
renderer , 154

D

Data source , 41
Data structure
internal , 61
native , 63
reflective , 62
selecting , 116
Dataset , 152
Deallocated state , 199
Decorator pattern , 121
Default renderer , 156
DefaultTableCellRenderer , 155
DefaultTableModel , 152
Delete keyword , 31
delete keyword , 31
Deployment , 53, 183
Design phase , 14
Developing a performance process , 9
Dimension , 88
Dispatching events , 180
dispose , 199
Distributed applications , 162
Documentation requirements , 90
Downloading
dynamic , 187
programs , 184
Dynamic
compilation , 191, 205
downloading , 187
proxy objects , 75
reflection , 67
DynamicProxy , 76

E

Eager loading , 69
Efficiency , 3
garbage collection , 209
Eliminating temporary objects , 90
Empirical testing , 37
Encapsulation , 13, 123
Environment, runtime , 21, 142
Estimating object size , 57
Event
dispatching , 165, 180
model , 74
EventQueue , 167
Examining JNI costs , 133
Examples
collections , 123
flat profile , 35
garbage collection , 201
grid drawing framework , 107
improved program launcher , 82
improved serialization , 49
native graphics , 129
office suite , 77
physics simulation framework , 91
program launcher , 84
searching the web , 178
serialization , 48
spreadsheet , 82, 151, 157
stopwatch , 20
string reverser , 113
sum computer , 104
timer , 174
word processor , 32
Execution times , 28
Explicit notifications , 164
Express Search , 178

F

Factory method , 69, 121
File streams , 47
FileInputStream , 43
FileOutputStream , 43
Filter , 41
Filter streams , 41
Final keyword , 92, 99
finalize , 198
Finalized state , 198
Finalizer , 64, 200
Flags, -X , 28, 213
Flags, -XX , 216, 217
Flat profiles , 32
example , 35
FlatLiner , 112
Flattening objects , 47, 51
Font , 28
FontMetrics , 30
Footprint
compile threshold and , 217
computing , 53
measuring , 54
memory , 31, 98
object pooling and , 98
optimizing , 53
problems , 31
FTP , 47

G

Garbage collection , 31, 59, 98, 199
conservative , 208
efficiency , 209
guarantees , 193
incremental , 210
mark-compact , 210
memory management , 208
GC. See garbage collection.
Generational copying collection , 209
Geometry classes , 88
getBounds , 92
getCustomerAddress , 186
getFontMetrics , 29
getIntArrayRegion , 137
getLocation , 96
getPrimitiveArrayCritical , 140
getStates , 100
getTableCellRendererComponent , 155
getValueAt , 155
Graphical User Interface. See GUI
Grid drawing
benchmark , 111
framework example , 107
GridTest , 111
GUI
example , 179
guidelines , 161
inner classes , 72
perceived performance , 7

H

Hanoi, Towers of , 113
Hardware configuration , 11, 12
HashMap , 120, 152
HashSet , 120
Hashtable , 98
Heap , 51, 53, 140, 214
Heap profiler , 28
Hot spot , 28, 104, 212
HotSpot , 97, 206
architecture , 205
optimizations , 213
virtual machine , 205
hprof , 28
HTTP server , 47, 180

I

I/O , 41, 180
performance , 41
If-statement , 112
If-then-else , 73
Image , 175
Immutable , 91, 123
collections , 123
objects , 85, 123
Implementations, runtime , 21, 63
Incremental garbage collector , 210
InfoSeek , 178
initFrameRate , 176
Initialization
costs , 32
delayed , 61
overhead , 99
Inlining , 211
Inner classes , 70, 71
Input streams , 180
InputStream , 41
Insets , 88
Inspecting memory , 54
Intermediate objects , 85
Internal data structure , 61
interrupt , 180
InterruptedIOException , 180
Interrupting a worker thread , 180
In-use state , 195, 205
Invalidate , 166
Invisible state , 196
InvocationHandler , 76
invoke , 75
invokeAndWait , 167, 168
invokeLater , 167, 173
isInterrupted , 180
Iterating
over a collection , 124
over a loop , 87
Iterator , 100

J

JAR file , 184, 186
Java 3D , 143
Java archive. See JAR file
Java Foundation Classes. See JFC
Java Media Framework. See JMF
Java Native Interface. See JNI
Java Plug-In , 188
Java programming language
copy , 136
Java Servlets. See servlets
Java Virtual Machine. See JVM
java.awt , 88, 167
java.awt.Button , 64
java.awt.Component , 88
java.awt.Container , 88
java.awt.Frame , 32
java.exe , 55
java.io , 41
java.io hierarchy , 41
java.lang.ref , 200
java.lang.ref hierarchy , 199
java.lang.reflect.InvocationHandler , 75
java.lang.reflect.Proxy , 75
java.lang.Runtime , 53
java.lang.StringBuffer , 87
java.lang.System , 18
java.math , 97, 143
java.util , 168
java.util.Arrays , 123
java.util.Collections , 123
java.util.Hashtable , 116
java.util.Random , 126
java.util.Timer , 173
java.util.Vector , 116
JavaBeans , 70, 164
javac , 62, 87, 183
JavaServer Pages , 24
javax.swing , 168
javax.swing.JFrame , 32
javax.swing.JTable , 77
javax.Swing.Timer , 172
javax.swing.UIDefaults.ProxyLazyValue , 77
JButton , 70
JComboBox , 116, 149, 150
JComponent , 90, 91, 157, 166
JFC , 13, 145, 183
JFrame , 166
Jini , 47
JIT
code generators , 63
compiled code , 63
compilers , 208
optimizations , 187
JLabel , 147
JList , 154
JMark , 21
JMeter , 24
JMF , 142
JNI , 129, 197, 215, 219
costs , 133
patterns , 136
JPEG , 43
JTable , 13, 35, 61, 154
JTextField , 167
JTree , 148
Just-In-Time compiler. See JIT
JViewport , 35
JVM
HotSpot , 205
specification , 205
JVMS. See Java Virtual Machine Specification

K

Key points (sections)
algorithms and data structures , 127
controlling class loading , 84
deployment , 189
I/O performance , 52
measurement is everything , 36
object mutability , 102
performance process , 16
RAM footprint , 65
Swing models and renderers , 159
using native code , 144
writing responsive user interfaces , 181
Keyword
const , 91, 92, 96
delete , 31
final , 92, 99
new , 31, 86
transient , 49, 51, 52

L

Large datasets , 147
Leaks , 31, 54, 180, 201
Learning curve , 90
Legacy code , 91
Line drawing , 108, 133
LineDrawer , 107
LinkedList , 13, 119
List , 13, 126
Listeners , 166
collapsing , 72
lists , 166
ListenerThread , 82
ListenerType , 166
Load factor , 120
Locating leaks , 31
Location , 91
Locking , 211

M

Macro-benchmark , 23
Maintaining encapsulation , 123
Maintenance costs , 90
Managing memory , 98
Map , 120
Mark-compact collector , 210
Measuring
class loads , 64
object size , 58
a program's true footprint , 54
software performance , 1
a system under load , 6
memcpy , 140
Memory , 31
allocation , 30, 208
consumption , 63
footprint , 31, 98
inspecting , 54
leaks , 31, 54, 180, 201
management , 98, 208
usage , 4, 30, 53, 200, 208
virtual , 4, 53, 193
Merge sort , 122
MetalWorks , 184
Method execution times , 27
Micro-benchmark , 22
Minimum hardware configuration , 11
Model , 149, 157
and renderers , 145
custom , 152, 153
Model-View-Controller. See MVC architecture
modInverse , 97
modPow , 97
Mutability
array , 99
case study , 97
controlling , 127
object , 85, 88, 98, 123
strategies , 91
MutableBigInteger , 97
MutableLocation , 96
MVC architecture , 145
myGlobalTimer , 173

N

Native code , 56, 129, 197, 212
case studies , 142
comparison , 132
data structures , 63
graphics example , 129
using , 129
Native libraries , 64
nativecritical , 135
nativecriticalmemcpy , 140
nativedoabsolutelynothing , 136
nativedonothing , 138
nativepullonly , 135
Network
socket , 47
traffic , 25, 51
new keyword , 31, 86
Notation , 104
NothingComponent , 156
Notifications
explicit , 164
reducing , 149
N-squared algorithm , 106
NT , 55, 78

O

O(1) algorithm , 104
O(n) algorithm , 104
O(n2) algorithm , 105
Object
caching , 98
flattened , 47
heap , 51, 53, 140, 214
immutable , 85, 123
intermediate , 85
lifecycle , 194
mutability , 85, 98, 123
pooling , 98
reference , 199
serialization , 47
size
computing , 57
estimating , 57
measuring , 58
optimizing , 61
strategies , 91
temporary , 90, 156
ObjectInputStream , 49
Object-oriented design (OOD) , 12, 35
Object-oriented software development , 9
ObjectOutputStream , 50
Office suite example , 77
Optimizing
object size , 61
RAM footprint , 53
order , 104
Order-n algorithm , 104
OutOfMemoryError , 156, 199, 215
OutputStream , 44
Overhead , 169
cell , 154
copying , 123
initialization , 99

P

pack , 165
Packaging
applets , 186
utilities , 187
paintComponent , 175
Patterns
call , 136
call-invoke , 141
call-pull , 137
call-pull-push , 138
call-pull-push with critical , 139
concentrator , 164
const , 91
decorator , 121
singleton , 30
Performance , 10
bottlenecks , 27, 86
computational , 4, 70, 211
degradation , 22, 105
perceived , 7, 181, 183
process , 9
profiling , 9, 32, 89
requirements , 11
testing , 14, 125
tracking , 21
tuning , 10
Persistent state , 51
Phantom
reachable state , 201
reference , 201
Physics simulation framework example , 91
Plain arrays , 122
Planned limitations , 11
Pluggable look-and-feel (PLAF) , 145
pmap , 55
Pooling objects , 98
Primitive types , 90, 122
PrintBytecodeHistogram , 217
println , 115
Problem space , 107
Processing text , 86
Product specification , 11
Production environment , 24
Profiler , 29, 201, 215
analyzing results , 15
heap , 28
Profiling , 15, 27
execution times , 28
memory usage , 30
performance , 9, 32, 89
results , 94
to locate memory leaks , 31
tools , 15, 30, 62, 89
Program launcher example , 82
Program size , 184
Programming language
C , 42, 142, 207
C++ , 31, 92, 207
Programming language, C++ , xviii
programQuit , 83
Proxy , 76
dynamic , 75
using , 74
Public API , 95

Q

Quality assurance , 14, 199
Quantitative results , 12, 17

R

RAM footprint , 4, 53, 72, 186
Random numbers , 126
randomAccess , 126
readObject , 50
Realized , 165
Rectangle , 91
Recursion , 112
Reducing
number of classes , 70
download time , 184
program size , 184
Reference
objects , 199
phantom , 201
soft , 201
strong , 202
types , 200
weak , 200, 202
References
algorithms and data structures , 127
garbage collection , 203
general , 219
object-oriented design , 15
Reflection
data structures , 62
dynamic , 67
using , 73
ReflectiveAction , 74
Renderer , 147, 155
custom , 154
default , 156
Resources, accessing , 186
Responsive user interfaces , 161
Results, quantitative , 17
Resurrection , 200
RMI , 51
RowHeaderModel , 158
RowHeaderRenderer , 157
Runnable , 167
Running multiple programs , 79
Runtime
environment , 21, 142
features , 208
implementations , 21, 63

S

Scalability , 6, 16, 31, 105, 148, 164
Scenarios , 11
SciMark , 21
Scrolling speed , 35, 155
Search Party example , 179
SearchWorker , 180
See HotSpot
Selecting
algorithms , 103
data structures , 116
timer classes , 173
Serialization , 47
example , 48, 49
ServerSocket , 82
Servlets , 86
Set , 119
setBounds , 89
setIntArrayRegion , 138
setTimer , 169
SheetMetal example , 157
Sherlock , 178
Shipping criteria , 14
SIGALRM , 169
Single-thread rule , 165
Singleton pattern , 30
Slow methods , 29
Small objects and the modern JVM , 97
SmallTalk , 86, 145
Soft reference , 201
Softly reachable , 201
Software development process , 9
Software performance, measuring , 1
Software requirements specification. See SRS
Solaris , 56, 142, 185
Solution
brute-force , 107
elegant , 106
Sort , 122
SortedMap , 120
SortedSet , 120
SpecJVM , 21, 213
Spreadsheet example , 151
SpreadsheetRowHeader , 157
SRS , 11
StackOverflowError , 113
startFade , 175
Startup time , 5, 24, 185, 206
State
finalized , 198
invisible , 196
phantom reachable , 201
unreachable , 197
Statistics , 26, 217
stdio , 42
Stopwatch , 20, 124
Strategy , 29, 199
deployment , 183
mutable objects , 91
Streams , 41
buffered , 41
buffering , 42
file , 47
filter , 41
input , 180
String , 86, 87, 112
StringBuffer , 87
String-reverser example , 113
Strong reference , 202
Strongly reachable , 201
Sum computer example , 104
Super-linear behavior , 105
Swing , 35, 61, 102, 145
component architecture , 145
components , 147
models and renderers , 145
scalable components , 147
single-thread rule , 165
writing responsive GUIs , 164
Swing Connection, The , 161
SwingTimerTask , 175
SwingUtilities , 167
SwingWorker , 177
Synchronized collections , 120
System requirements , 12, 194
System.arrayCopy , 119, 141
System.exit , 84
System.getCurrentMillis , 126

T

TableModel , 153
Tactics
const pattern , 91
custom models , 153
custom renderers , 156
dynamic proxies , 75
object pooling , 98
reflection , 70
testing for easy-to-solve subcases , 112
trampolines , 74
Tagging interface , 48
Target configuration , 4, 12, 24
Task Manager , 55, 78
Temporary
allocations , 90
objects , 90, 156
Test configuration , 37
Testing
empirical , 37
phase , 14
Testing performance , 14, 125
Text processing , 86
Thread.interrupt , 180
Thread.interrupted , 180
Thread.isInterrupted , 180
Thread.MIN_PRIORITY , 179
Threads , 63, 98, 170
priority , 179
synchronization , 211
using , 164
worker , 178
Thread-safe , 165
Timer , 171, 172, 173
Timers , 168
choosing , 173
example , 174
using , 168
TimerTask , 172
Tools
benchmarking , 17
packaging , 187
profiling , 15, 30, 62, 89
toString , 87
totalMemory , 54
Towers of Hanoi , 113
Tracking performance , 21
Trade-offs , 18, 45, 116, 117
Trampoline , 74
transient , 51, 52, 164
Translator framework , 68
TreeMap , 120
TreeSet , 120, 125
Trend analysis , 21
Tuning process , 10
Types
primitive , 90, 122
reference object , 200

U

UI delegate , 145
UIDefaults , 77
UIManager , 158
Unreachable state , 197
UnsupportedOperationException , 100, 123
User input , 161, 199
Using
a proxy , 74
custom models , 152
custom models and renderers together , 157
custom renderers , 154
invokeAndWait , 167
invokeLater , 167
native code , 129
recursive algorithms , 112
reflection , 73
threads , 164
timers , 168
Utilities, packaging , 187

V

Virtual Machine
HotSpot , xvii
Virtual machine. See JVM
Virtual memory , 4, 53, 193
VolanoMark , 21

W

Weak reference , 200, 202
example , 201
Weakly reachable , 201
WeakReference , 201
Web search example , 178
Web server , 24, 185
What contributes to footprint? , 55
What is a collection? , 116
What is performance? , 3
Who uses these tactics? , 77
Why build benchmarks? , 21
Why should I care about garbage collection? , 193
Windows NT , 55, 78
Word processor example , 68
Worker thread , 178
Interrupting , 180
priority , 179
Worst case , 26
Wrapper-synchronized collection , 121

X

-X flags , 28, 213
-Xbatch , 214
-Xincgc , 214
-Xms , 214
-Xmx , 215
-Xnoclassgc , 214
-Xprof , 215
-XX flags , 216

Index



[Contents] [Prev] [Next] [Index]

Copyright © 2001, Sun Microsystems,Inc.. All rights reserved.