HNHacker News
TopNewBestAskShowJobs

peter_lawrey

68 karma · joined July 13, 2011

submissionscomments
peter_lawrey··on Java is better than C++ for high speed trading systems
If you have multiple processes each with 24 GB of Eden space and you can produce 1 GB/hour of garbage in each service and still only GC once a day.
peter_lawrey··on Java is better than C++ for high speed trading systems
Projects with limit time and resources can be completed faster with a high level language giving you more time to optimise it. A well optimised Java application can perform better than a poorly optimised C++ application.
peter_lawrey··on Java is better than C++ for high speed trading systems
The trading systems we work on have a wire-to-wire latency of 20 - 50 microseconds on the 99.9%ile. It really depends on what you are looking to achieve.
peter_lawrey··on Java is better than C++ for high speed trading systems
Most trading systems I work on only need a very small portion to be highly optimised. As long as most of the code is pretty efficient that is fine.
peter_lawrey··on C++ or Java, which is faster for high frequency trading?
Most of the 10 micro-seconds is spent receiving the UDP/TCP packet, decoding it, building an order request and sending it.

Only a fraction of this time is left to make a decision. ;)

peter_lawrey··on C++ or Java, which is faster for high frequency trading?
LMAX is more high throughput than low latency. Most exchanges are about 10x slower than the trading systems which connect to them. This is because the exchange has handle all its clients, whereas the trading system can limit itself to less products and a few exchanges.
peter_lawrey··on C++ or Java, which is faster for high frequency trading?
I would be interested if you could expand on this speculation?
peter_lawrey··on C++ or Java, which is faster for high frequency trading?
I agree, avoiding GC is paramount. You can do this in Java by discarding less objects. http://vanillajava.blogspot.com/2011/06/how-to-avoid-garbage...
peter_lawrey··on How to get C like performance in Java
I agree, I am suggesting that "no pointer = no speed" is not demonstrated by the benchmarks provided. The developers who wrote the benchmarks which were faster than the C/C++ ones didn't appear to agree. i.e. when they has the optional to use them, they didn't and were still faster.
peter_lawrey··on How to get C like performance in Java
Fair point.
peter_lawrey··on How to get C like performance in Java
From a search I did suggest that Google have nowhere near 10K users per server. That is likely to be because the servers spend most of their time performing searches. The overhead of managing persistent connection is likely to be a small portion of what they do, like most real applications.
peter_lawrey··on How to get C like performance in Java
That's a good link. The n-body and spectral-norm benchmarks were fastest in Fortran. The fannkuch benchmark was fastest in Ada. The Mandlebrot benchmark was fastest in ATS.

In each case, the language has pointers, however they were not used in the core part of the benchmark. i.e. they didn't get their speed advantage from pointers.

Haskell was the fastest for the thread-ring benchmark, it doesn't have pointers.

If Java had pointers as it does in the sun.misc.Unsafe utility class some code would be faster, but I don't believe this explains why Java is not the fastest in each benchmark. ;)

Object orientated programming is used in a significant portion of all programs, it would be interesting how C/C++ performs in such benchmarks. ;)

peter_lawrey··on How to get C like performance in Java
In your experience, have you ever seen or heard of a business or web site with more than 10K concurrent users who thought it was a good idea to place all those users on just one server?
peter_lawrey··on Incorrect Core Java Interview Answers
A pedantic interviewer won't tell you if mix your terminology incorrectly. The more experience you have, the more pedantic you tend to get because computers are pedantic. They do exactly what you tell them to, not what you meant it to do. ;)
peter_lawrey··on Incorrect Core Java Interview Answers
pass-by-reference has a particular meaning. Java does not support this.

There are plenty of pages on the web explaining why suggesting Java support pass-by-reference is incorrect.

http://www.google.com/search?q=java+pass+by+reference

peter_lawrey··on Incorrect Core Java Interview Answers
A Class is a proxy for the underlying representation of the type/class. IMHO, int.class is just as much a Class as Integer.class.

The compiler does next to no optimisations and the "client" JIT doesn't remove loops which don't do anything. Only the "server" JIT eliminates such loops, after it has compiled the method which can be triggered by loop which loops many times.

peter_lawrey··on How to get C like performance in Java
Dell sell one.

However for £1K which is about $1.5k you can buy a PC with 24 GB, a 3.8 GHz i7, 120 GB SSD, two screens. ;)

peter_lawrey··on How to get C like performance in Java
Can you provide any benchmarks which support this as I can provide plenty which don't?
peter_lawrey··on How to get C like performance in Java
If you create low enough garbage and your eden size is large enough, you can avoid having any minor collections at all. I have a full GC which is triggered once per night as maintainence.
peter_lawrey··on How to get C like performance in Java
> Terrible advice. Use NIO and do it properly. Creating 1 thread per connection is for unskilled programmers. Sometimes the simple solutions are the best. Developing a complex and clever solution may your feel more skilled. Using a dispacther pattern often doesn't provides a real advantage and or the advantage it provides isn't needed.

I would agree with the suggestion that if you are going to use a dispatcher pattern with NIO, use a library like netty which does this for you. (In any case you don't write it youself)

peter_lawrey··on How to get C like performance in Java
Does your comment suggest that it can't be that simple?
peter_lawrey··on How to get C like performance in Java
The answer to why would you still use Java is here "Java makes high level programming simpler and easier at the cost of making low level programming much harder. Fortunately most applications follow the rule of thumb that you spend 90% of your time in 10% of the code. This implies you are better off 90% of the time, worse off 10% of the time. ;)" Why would you develop mroe than a small portion of your application in a low level language unless every part of your application is performance critcal?
peter_lawrey··on How to get C like performance in Java
I would be very interested if you could explain what you mean. ;)
peter_lawrey··on How to get C like performance in Java
I would say I am less concerned about how memory is packed, than how much is discarded. This is because memory is relatively cheap these days. A machine with 24 GB of memory costs around £1K. However you make a good point that C++ gives you better control over how memory is arranged and you have to use hacks like the Unsafe class in Java (which is not as friendly)
peter_lawrey··on Java: All about 64-bit programming
AFAIK -d32 was the default on some versions of Solaris, but -d64 is the default now. Windows doesn't support these options. Linux does support -d32 but it has to be installed seperately, otherwise -d64 is the default for a 64-bit JVM.
peter_lawrey··on Java: All about 64-bit programming
http://vanillajava.blogspot.com/2011/07/new-toy-for-home.htm...

The computer runs at 3.8 GHz and came with two 20" screens. ;)

The £21K computer is a Dell incl. tax retail price from their web site.

Perhaps it sounds cheaper in £ instead of $ or € ;)

peter_lawrey··on Java Secret: Using an enum to build a State machine
Using this approach could be more logical, esp as the number of methods per state increases. As you have more complex events and you want to group as State/Method rather than Method/State this approach is more appealying.
peter_lawrey··on Java Secret: Using an enum to build a State machine
In a state machine, all the state should be in the context rather than the code blocks. The Java Tutorial on enums talks about fields and constructors.
peter_lawrey··on Java Secret: Using an enum to build a State machine
The secret part is that enums are under utilised even though they have been around since 2004. I would assume that many people don't realise how theyc an be used. Its no secret they exist. ;)
← PreviousPage 2 of 2