Home » Author Archives: Peter Lawrey (page 6)

Author Archives: Peter Lawrey

Odd practices in Java

java-logo

Overview There are a number of practices in Java which oddly baffle me. Here are but a few. Using -Xmx and -Xms The option -Xmx is widely used to set the maximum memory size. As noted in the Java HotSpot VM Options Options that begin with -X are non-standard (not guaranteed to be supported on all VM implementations), and are ...

Read More »

Latency, Throughput and Degree of Concurrency

software-development-2-logo

chrisapotek asked. How do you define throughput and latency for your test? There is not a simple question, so I have replied with a post. Sustained Throughput I consider throughput to be the number of actions a process can perform over a sustained period of time, between 10 seconds and day. (Assuming you have a quite period over night to ...

Read More »

Why Math.round(0.499999999999999917) rounds to 1 on Java 6

java-logo

Overview There are two types of error representation error and arithmetic rounding error which are common in floating point calculations. These two error combine in this simple example, Math.round(0.499999999999999917) rounds to 1 in Java 6. Representation error Floating point is a base 2 format, which means all number are represented as a sum of powers of 2. e.g. 6.25 is ...

Read More »

Quotes relating to System Design

software-development-2-logo

There are a few quotes I think of when thinking about computer design. These are not specifically about computers, but I think they are appropriate. Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. — Antoine de Saint-Exupery, French writer (1900 – 1944) “Simple can be harder than complex: ...

Read More »

High performance libraries in Java

java-logo

There is an increasing number of libraries which are described as high performance and have benchmarks to back that claim up. Here is a selection that I am aware of. Disruptor library – http://code.google.com/p/disruptor/ LMAX aims to be the fastest trading platform in the world. Clearly, in order to achieve this we needed to do something special to achieve very low-latency ...

Read More »

“Java Sucks” revisited

java-logo

Overview An interesting document on Java’s short comings (from C developer’s perspective) was written some time ago (about 2000? ) but many of the arguments issues are as true (or not) today as they were ten years ago. The original Java Sucks posting. Review of short comings Java doesn’t have free(). The author lists this as a benefit and 99% ...

Read More »

Using a memory mapped file for a huge matrix

java-logo

Overview Matrices can be really large, sometimes larger than you can hold in one array. You can extend the maximum size by having multiple arrays however this can make your heap size really large and inefficient. An alternative is to use a wrapper over a memory mapped file. The advantage of memory mapped files is that they have very little ...

Read More »

Recycling objects to improve performance

java-logo

Overview In a previous article I stated that the reason the deserialization of objects was faster was due to using recycled objects. This is potentially surprising for two reasons, 1) the belief that creating objects is so fast these days, it doesn’t matter or is just as fast as recycling yourself, 2) None of the serialization libraries use recycling by ...

Read More »

Java Secret: Loading and unloading static fields

java-logo

OVERVIEW To start with it is natural to assume that static fields have a special life cycle and live for the life of the application. You could assume that they live is a special place in memory like the start of memory in C or in the perm gen with the class meta information. However, it may be surprising to ...

Read More »

Weird Funny Java!

software-development-2-logo

Sometimes we can do really weird and funny things with Java; Some other times we are just being creative! Take a look at the following three examples and you will find out what I mean! Have Fun! Strine translator Translating to Strine ;)   public static void main(String... args) { System.out.println("Hello World"); } static { try { Field value = ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close