JProfiler is a great tool for tracking down pesky memory leaks and performance problems. Here’s a trick for configuring JProfiler for use with remote Java Web Start applications on OSX.
Category Archives: Optimization
Compressing Socket Data
The java.util.zip package includes classes for compressing and decompressing data using the ZLIB algorithms. The stream classes in the package are well-suited for accessing files and other bounded data, but do not work as well for compressing unbounded, continuous data transmitted over a socket. “Compressing data sent over a socket” describes the underlying issues and …
Batch Text Inserts with JTextPane
Part II of “Faster JTextPane Text Insertion” describes another technique for overcoming some of JTextPane‘s performance limitations when initiatializing large documents with complex styles. The ElementSpec class, defined as part of DefaultStyledDocument, provides a way to batch updates and apply them in bulk. Depending on size and complexity of the document, the speed boost can …
Why are JTextPane inserts so slow?
Inserting a large amount of styled text into a JTextPane can be painfully slow. Part I of “Faster JTextPane Text Insertion” examines two sources of sluggishness and illustrates a simple solution for one of them. (Part II will describe an additional solution.)
Low-Memory Deep Copies
“Faster Deep Copies of Java Objects” explains the concept of “deep copies” of Java objects and illustrates a common approach for copying objects using Java Object Serialization. “Low-Memory Deep Copy Technique for Java Objects” presents an alternate technique that trades speed for space.
Speeding Up Deep Copies
You can use Java Object Serialization to make deep copies of Java objects, creating distinct copies of an object and all of the objects that it references. “Faster Deep Copies of Java Objects” explains the difference between deep copies and shallow copies (as implemented by the clone method), shows a common approach to using Java …