Archives for the 'Optimization' Category
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.
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 [...]
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 [...]
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.)
“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.
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 [...]