Tag Archives: cache

Simple LRU or FIFO Cache

There is a very simple way to make a FIFO or LRU cache with the existing LinkedHashMap implementation of the default Java VM made by Joshua Bloch. The LinkedHashMap already has a method you can override, which defines when to … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

The size does matter! (partly)

Have you ever asked yourself, what memory size does an object or a primitive data type really uses? In general it uses a multiple of WORD. http://en.wikipedia.org/wiki/Word_%28computing%29 That means a multiple of 4 byte (32bit) or 8 byte (64bit), if … Continue reading

Posted in Java, Performance | Tagged , , , | Leave a comment

Java Performance Tuning with maximizing Integer.valueOf(int)

With http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#valueOf%28int%29 or auto boxing(uses internal a valueOf too) the cached Integer values will be used if they are between -127 and +128. Now I found coincidentally(by looking at the source) on a Java feature or more exactly on a … Continue reading

Posted in common practice, Performance | Tagged , , , | 1 Comment