Home » Author Archives: Peter Lawrey

Author Archives: Peter Lawrey

Comparing Hashing strategies

java-logo

Overview Chronicle has a number of implementations for hashing, including City and Murmur. It also has it’s own Vanilla Hash, but how was this tested? What is Vanilla Hash? Vanilla Hash is designed to be as simple as possible and be optimised for the Orthogonal Bits test (See below) This was compared with City 1.1 and Murmur 3 hashing strategies. ...

Read More »

Wiring YAML to a file or network with Chronicle Wire

java-interview-questions-answers

Overview Chronicle Wire is designed to get the benefits of a text protocol in terms of ease of development and faster debugging, but be able to switch to a more performant and smaller binary protocol without having to change your code. In this post, I looked at the performance you might achieve using a YAML based text format for serialization, ...

Read More »

Using YAML over the network

software-development-2-logo

Overview There is a number of popular text based protocols for exchanging data over the network. These include XML, FIX, and JSON. Chronicle Engine uses YAML which has some advantages and disadvantages. Isn’t text slower than binary? Text protocols are slower than binary protocols. The cost of encoding numbers and even unicode strings adds an overhead for the CPU. While ...

Read More »

Accessing Chronicle Engine via NFS

java-interview-questions-answers

Overview Chronicle Engine is a data virtualisation layer.  It abstracts away the complexity of accessing, manipulating and subscribing to various data source so that the user of that data doesn’t need to know how or where  the data is actually stored.  This means that this data can be migrated between systems or stored in a manner which is more efficient ...

Read More »

Is using Unsafe really about speed or functionality?

java-logo

Overview Around 6 years ago, I started using a class which up to that point was just a curiosity sun.misc.Unsafe.  I had used it for deserialization and re-throwing Exceptions but not used all it’s capabilities or talked about it publicly. The first open source library I saw which did use Unsafe in a serious way was Disruptor. This encouraged me ...

Read More »

How and Why to Serialize Lambdas

java-logo

Overview Serializing lambdas can be useful in a number of use cases such as persisting configuration, or as a visitor pattern to remote resources. Remote Visitors For example, so I want to access a resource on a remote Map, I can use get/put, but say I just want to return a field from the value of a Map, I can ...

Read More »

Puzzler: nested computeIfAbsent

java-logo

Overview The Java 8 libraries have a new method on map, computeIfAbsent. This is very useful way to turn your Map into a cache of objects associated with a key. However, there is a combination you might not have considered; what happens if you call computeIfAbsent inside itself. map.computeIfAbsent(Key.Hello, s -> { map.computeIfAbsent(Key.Hello, t -> 1); return 2; }); enum ...

Read More »

What are the bad features of Java

java-logo

Overview When you first learn to develop you see overly broad statements about different features to be bad, for design, performance, clarity, maintainability, it feels like a hack, or they just don’t like it. This might be backed by real world experience where removing the use of the feature improved the code. Sometimes this is because the developers didn’t know ...

Read More »

Inconsistent operation widen rules in Java

java-logo

Overview When you perform a unary or binary operation in Java the standard behaviour is to use the widest operand (or a wider one for byte, short and char).  This is simple to understand but can be confusing if you consider what the optimal type is likely to be. Multiplication When you perform multiplication, you often get a much large ...

Read More »

Java 8 Optional is not just for replacing a null value

java-logo

Overview In Java 8, you can return an Optional instead of return null; as you might do in Java 7. This may or may not make a big difference depending on whether you tend to forget to check for null or whether you use static code analysis to check to nullalbe references. However, there is a more compelling case which ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.