Posted on May, 10, 2017

Written by Najim , Software Developer, Chicago

Posted in Technology

Java in a nutshell

Java is the predominant language at IMC. Its best feature, and the real secret to success with the program, is its tracing Just-In-Time (JIT) compiler. The JIT compiler analyses, in real time, which parts of an algorithm need to be optimised for speed, and which can be ignored.

There are faster solutions out there, sure, but Java’s mature ecosystem, more robust libraries and developer tools, and more expert developers mean Java produces a faster time-to-market and time-to-performant paradigm that can’t be ignored.

Adapting the Pareto principle

Vilfredo Pareto’s 80-20 rule states that 80% of consequences come from 20% of causes. For our purposes this can be adapted to 90-10: 90% of an application’s execution time is spent executing 10% of the code. Identifying that 10% and optimising it is the key to speedier and more successful outcomes.

The JIT compiler does that by looking at our trading applications while they’re running and optimising those crucial components on the fly. It can adjust throughout the day to different circumstances. It’s as though, in our supermarket example, our cashier is joined by an assistant at particularly busy times of the day.

Defining ‘fast enough’

We need to look at performance from a scientific perspective and talk about it in measurable terms in order to decide what we’ll accept as ‘fast enough’, and assess whether the applications we use fit the bill. As Donald Knuth implores, the choice of technology should be an optimisation choice and not one lightly taken.

“Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimisation is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.” – Donald Knuth

The choice is yours

As Abraham Maslow stated, “I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail.” It’s important to understand that Java is just one tool in our toolbox. There will always be cases where it makes more sense to use C++ or FPGAs.

In our next article, we’ll explore the optimisation choices for trading applications.