Slashdot Mirror


Using Java In Low Latency Environments

twofishy writes "Something I've noticed amongst financial service companies in London is a growing use of Java in preference to C/C++ for exchange systems, High Frequency Trading and over low-latency work. InfoQ has a good written panel discussion with Peter Lawrey, Martin Thompson, Todd L. Montgomery and Andy Piper. From the article: 'Often the faster an algorithm can be put into the market, the more advantage it has. Many algorithms have a shelf life and quicker time to market is key in taking advantage of that. With the community around Java and the options available, it can definitely be a competitive advantage, as opposed to C or C++ where the options may not be as broad for the use case. Sometimes, though, pure low latency can rule out other concerns. I think currently, the difference in performance between Java and C++ is so close that it's not a black and white decision based solely on speed. Improvements in GC techniques, JIT optimizations, and managed runtimes have made traditional Java weaknesses with respect to performance into some very compelling strengths that are not easy to ignore.'"

371 comments

  1. Thanks Dice!! by Anonymous Coward · · Score: 2, Insightful

    This Slashvertisement brought to you by: Dice.com

  2. Java and Latency by Anonymous Coward · · Score: 3, Funny

    I find java helps me with my latency :)

    1. Re:Java and Latency by Anonymous Coward · · Score: 0

      Have you tried JA or LA? Both are anonymous and can really help. Of course then meetings are very large and you'll have to wait your turn to "share" but you're already used to that.

    2. Re:Java and Latency by Mitchell314 · · Score: 2

      And always get interrupted by that obnoxious garbage-cleanup crew.

      --
      I read TFA and all I got was this lousy cookie
    3. Re: Java and Latency by Anonymous Coward · · Score: 0

      HFT, yeah use it and lose it..

    4. Re:Java and Latency by Anonymous Coward · · Score: 0

      But have you tried to sprinkle some FPGA powder over the java, to have some crunch on the top?

  3. Huh? by TWX · · Score: 1, Insightful

    Why would the language of choice matter terribly much if the programmer has skills with the language?

    Wouldn't a C++ programmer generate an applicable program effectively as quickly as a Java programmer? It's not like compiling is the time-consuming part anymore...

    --
    Do not look into laser with remaining eye.
    1. Re:Huh? by bunratty · · Score: 4, Informative

      Programs written in some languages run more quickly than those written in other languages. Some languages allow you to write programs more quickly than other languages. Therefore, the choice of language is always a tradeoff. There is no perfect programming language, and no, not all programming languages are alike as you seem to believe. If I want to write a program quickly, I write it in Python even though I know the program will run quite slowly.

      --
      What a fool believes, he sees, no wise man has the power to reason away.
    2. Re:Huh? by i_ate_god · · Score: 3, Funny

      well I am a master of PHP, so let's find out...

      --
      I'm god, but it's a bit of a drag really...
    3. Re:Huh? by medv4380 · · Score: 1

      Their referring to the lag you get in launching a Java App. There are ways around those issues, but not ways that are native to the language or the platform. Up until the hotspots are found and compiled a Java App is pretty slow. I'm not sure if this should be an issue with HFT though. The Algorithm should be persistent in memory for the trading day. The host spots should be found and compiled within a few minutes. Unless they are repeatedly launching it there shouldn't be a problem.

    4. Re:Huh? by Anonymous Coward · · Score: 0

      Indeed, in grad school I came face=to-face with this. I had to write a shot-gun gen sequencing algorithm*, and I had been doing work in Python primarily for a while. I wrote up a quick solution, hit run... several minutes later, I stopped it, added some comments so I could track the progress, hit run.... several minutes later it became obvious that I would need something faster. Ported the code over to C++, I think it finished in about 90s.**

      * given a set of dna strands sequenced from random parts of the chromosome, with errors, rebuild the original sequence.
      ** for the version that assumed we only sequenced one strand of the chromosome (an impossibility), the algorithm modification I made to get rid of that assumption filled my 4Gb of memory and core dumped.

    5. Re:Huh? by MatthewNewberg · · Score: 1

      "It's not like compiling is the time-consuming part anymore" needs a sarcasm tag attached to it. Some people still deal with large compile times.

    6. Re:Huh? by elfprince13 · · Score: 4, Interesting

      Manual memory management is a whole class of bugs that Java doesn't have to deal with. A good C/C++ programmer shouldn't have *that* much difficulty, but it does add to debugging costs and detracts from mental focus on the algorithmic aspects of the problem.

    7. Re:Huh? by Xest · · Score: 5, Insightful

      "Wouldn't a C++ programmer generate an applicable program effectively as quickly as a Java programmer?"

      No, some languages simply are slower to develop with and debug. The problem is also made worse depending on the frameworks and IDEs available. As an example, you're going to get your work done way quicker writing an application manipulating dates and times using C# and Visual Studio than you are Java and Eclipse because until Java 8 Java's date time functionality is shit and Eclipse is a dog slow IDE. With Java 8 and say NetBeans or JDeveloper though things will be pretty similar.

      At the end of the day with C/C++ you have to deal with memory management and that's just one additional piece of work that you don't have to be so concerned with with Java. C/C++ give you more scope for optimisation and more control over memory management as a benefit of that though. It's about trade-offs and figuring out what matters.

      But it's possible to be great at both C++ and Java without having to descend into petty arguments as to which is better and know when to use each in response to a specific task, and that's the sort of great programmer these institutions will be looking for and this is really what they're talking about - both have their place but in some cases getting a trading application to market a day earlier than the competition even at slight latency trade-off may be enough to net your company a few million dollars advantage. In other cases, the latency improvements of a highly optimised C++ application may instead be the key to scooping up those extra millions.

    8. Re:Huh? by gl4ss · · Score: 1

      for this kind of scenario I would say to write and tweak it in java.. once it's been stable in what it actually does, then rewrite it in java, then do it in c++ or c.

      though I suspect part of the problem with doing these battle algos is the need to evolve them constantly.

      --
      world was created 5 seconds before this post as it is.
    9. Re:Huh? by Anonymous Coward · · Score: 0

      Why would the language of choice matter terribly much if the programmer has skills with the language?

      Wouldn't a C++ programmer generate an applicable program effectively as quickly as a Java programmer? It's not like compiling is the time-consuming part anymore...

      Well it depends. If you're talking about an algorithm that needs to be thought up in the shower in the morning and in deployment by mid-day, than a lot of the "idiotproofing" and "syntactic sugar" that are commonly derided as unnecessary become a bigger deal.

      C++ in particular has a lot of "gotchas" that could cost you precious hours to work around. Java probably would not have been my first choice, but I'm not an HFT programmer so I don't know what the hard parts of that problem set are.

    10. Re:Huh? by h4rr4r · · Score: 1

      That is a problem money can solve.

      A TB of ram and all PCIE SSDs can do wonders.

    11. Re:Huh? by LostMyBeaver · · Score: 4, Informative

      Some people also work on multi-million line projects which compile in a minute or less. It's a trade-off. Most compiler issues are related to obscene (and generally unnecessary) amounts of header dependencies. 1000 lines takes an almost immeasurably small period of time to compile, but a 2 line file can take a minute if it includes the wrong headers. The ISO C/C++ library or boost is pure evil in these regards.

      A well formed program can compile extremely rapidly. A poorly formed program can often compile extremely quickly with enough CPUs working in parallel across a fast enough network. However a decent program will take time for the initial compile but take almost no time for each consecutive compile when only a file here or there changes.

      Also, to make things politically incorrect on Slashdot, good tools like Visual C++ 2012 can even take poor code and make it compile quickly if the projects files are designed well. Do your coding there and compile it later on GCC.

    12. Re:Huh? by Anonymous Coward · · Score: 0

      Try saying that for Malbolge. ;)

      I'm a Haskell programmer, and to me, using C/C++ is like using Malbolge. It...just...hurts...so...much...

    13. Re:Huh? by Anonymous Coward · · Score: 0

      They are talking about two kinds of latency, but not about startup latency: First, There are more Java developers, so shorter time-to-market. Second, the Java runtime isn't realtime capable, i.e. it does not guarantee an upper bound to latency. Many times the cause is the garbage collector, which needs to run occasionally to free memory that is no longer occupied by active objects. Depending on the implementation of the GC, this can halt execution for a short time, and this causes a latency spike from the point of view of the application.

    14. Re:Huh? by Anonymous Coward · · Score: 1

      Run it or compile it to native C code with PyPy! http://pypy.org/

    15. Re:Huh? by Xest · · Score: 1, Insightful

      Yes, I'm a Microsoft shill, that's why I praised an Open Source IDE (NetBeans), a competitors proprietary IDE (JDeveloper) as well as the Java language and in another thread only about half an hour ago said good things about Sony, and Nintendo. Two days ago I was apparently a Samsung shill too.

      Has it really come to this? If you dare praise any company or one of it's products for absolutely anything then you're a shill?

      The worst part is because I'm not a fanboy and I praise any company that does something good and criticise any that doesn't I must be a shill for every tech company on earth because even those I least like such as Apple I've praised sometimes (i.e. for shaking up the smartphone market and forcing innovation) and Facebook though I have a mostly negative view of it produced a nice clean site relative to the social networks that came before it (MySpace) crushing them as a result.

      If only I really was collecting all those paycheques from the entire who's who list of wealthy silicon valley firms...

    16. Re:Huh? by darkHanzz · · Score: 4, Informative

      Use RAII consistently, and use containers (from stl or otherwise) which have asserts() on bounds-checking. Bonus points for a tiny unit-test (which can therefore run at the end of every compilation). You'll be amazed at how stable, maintainable, easy to debug and performant your code will be.
      Do the hardcore pointer handling only where the profiler tells you that it matters and there's no way java even gets close in performance

    17. Re:Huh? by MindStalker · · Score: 3, Insightful

      Honestly, when your task is, "Grab data from mysql, dump it to screen." There really is nothing faster than coding it in PHP. Its quick, its easy, and it gets the job done as fast as a shell script.

    18. Re: Huh? by Anonymous Coward · · Score: 0

      Parroting Sun/Oracle shill propaganda are we?

    19. Re:Huh? by h4rr4r · · Score: 0

      Go away pathetic troll.
      And learn to write better software.

    20. Re:Huh? by parlancex · · Score: 4, Insightful

      Garbage collection creates a different class of problems, namely that the performance characteristics of your program become non-deterministic. This is a Big Deal for certain classes of applications such as video games and in particular HFT. Would you like to be the person explaining why the GC caused your program to stall at an inopportune time for 50ms and lost somebody a few million bucks?

    21. Re:Huh? by Anonymous Coward · · Score: 0, Flamebait

      Some people also work on multi-million line projects which compile in a minute or less.

      Care to name even 3 projects like this? Because having done over a decade of release work across numerous platforms and languages, I've yet to see a single large project that even comes close to approaching this benchmark. The fastest "big project" - and capable of high levels of parallelization across several servers, since it was comprised of many independent api libraries - took about 45 minutes on a brand new (at the time server). Most of the multi-million line projects I've seen take upwards of an hour, many more than 2 or 3 hours, to perform a full build.

      And if you meant "I can compile my 2 changed files and link them together so I can unit test," in a minute or two, then congratulations, you can write a makefile. But that binary in your workspace better not be going to production, son.

    22. Re:Huh? by Anonymous Coward · · Score: 2, Insightful

      In the real world so what if you know how to write better software. If you have a job to maintain some old large software, you're mostly stuck with its compile times.

      Rewriting it "better" would take many years - you'd be sacked long before you succeeded.

    23. Re:Huh? by Gr8Apes · · Score: 1

      I'd have to agree here - multi-thousand maybe, a million lines? Not a chance unless it's an academic exercise which does nothing useful.

      --
      The cesspool just got a check and balance.
    24. Re:Huh? by bws111 · · Score: 4, Informative

      Any JVM that would run this code will be tunable, including the ability to tune the GC so it becomes more deterministic. The fact that your desktop app runs in 'use all memory then GC' does not mean that is the only way the JVM can work.

    25. Re:Huh? by Infiniti2000 · · Score: 5, Informative
    26. Re:Huh? by elfprince13 · · Score: 1

      Bingo.

    27. Re:Huh? by Anonymous Coward · · Score: 0

      That's a claim you need to prove as the article is saying the opposite.

    28. Re:Huh? by Anonymous Coward · · Score: 0

      Seriously. I feel like all this "C++ is slow" is from people who know a little C and stl vector and call themselves C++ programmers. Yes, if you litter raw pointers all over the place you're going to have unmaintainable trash. If you don't take advantage of the STL and its features, and maybe a little boost, your code will be less clean. You can do this in Java too, just litter JNI trash in all the same places. Don't claim you know the language if you don't. I haven't had to write a destructor in months.

      As shitty as the name is, RAII really makes C++ as fast (to write) as Java, and human readable as a bonus.

    29. Re:Huh? by Anonymous Coward · · Score: 0

      That does help, but it doesn't make C++ as easy to deal with as Java. I wanted to write a longer reply, but I'm too busy reading a template error novel for my job.

    30. Re:Huh? by Anonymous Coward · · Score: 0

      PHP's MySQL API is painfully bad. I'd much rather use Perl with DBI. Much easier on the brain.

    31. Re:Huh? by sergueyz · · Score: 1

      You can as well use Haskell, where you write quickly, code is succinct and program runs fast.

    32. Re:Huh? by Anonymous Coward · · Score: 0

      Manual memory management is a whole class of bugs that Java doesn't have to deal with. A good C/C++ programmer shouldn't have *that* much difficulty, but it does add to debugging costs and detracts from mental focus on the algorithmic aspects of the problem.

      It doesn't "detract" from my mental focus at all.

      Instead, I view memory management as an integral part of the algorithm design.

      When you used the phrase "algorithmic aspects of the problem" you seemed to imply that memory management is divorced from that, and that memory mangement is something to be separately designed and bolted on later. That is a very unwise approach.

      I have found the best approach is to take memory usage into consideration as you do the algorithm design. Often, it simply means having a good understanding of when objects come into existence, and when they go out of existence. For me, taking such things into consideration doesn't "detract" in any way from solving the problem. In my view, efficient use of memory is just another goal of the algorithm design.

    33. Re:Huh? by Anonymous Coward · · Score: 0

      What about SQL? ( select * from table1; ) ? Is PHP faster to write than that?

    34. Re:Huh? by postmortem · · Score: 1

      Good points, and C++ has one thing going for it. Qt framework. Java-like interfaces for fast development, with C++ performance, and a minimal memory management.

    35. Re:Huh? by Anonymous Coward · · Score: 0

      You can get similar benefit by writing everything in Java and using the JNI to call C code when necessary. Six of one, half a dozen of the other.

    36. Re:Huh? by smcdow · · Score: 4, Interesting

      The article suggest that one solution is to simply not do GC until the end of the trading day. I have to admit that's a good pragmatic solution, certainly so for HF prop traders.

      Not enough memory on your servers? Add more. Still not enough? Add even more. The cost would be a pittance for any prop trading company worth its salt.

      --
      In the course of every project, it will become necessary to shoot the scientists and begin production.
    37. Re:Huh? by aaaaaaargh! · · Score: 1

      You can as well use Haskell, where you write quickly, code is succinct and program runs fast.

      ...if you're a brain damaged computer scientist. Real men don't need no stinkin' monads, they have no quirks with side effects.

    38. Re:Huh? by Anonymous Coward · · Score: 0

      Garbage collection creates a different class of problems, namely that the performance characteristics of your program become non-deterministic.

      It already becomes non-deterministic when you use the heap.

    39. Re:Huh? by ebno-10db · · Score: 2

      That's a claim you need to prove as the article is saying the opposite.

      That's a claim the article needs to prove. It was just a bunch of assertions, many by people who have a vested interest in the use of Java.

    40. Re:Huh? by KingMotley · · Score: 1

      Well except for maybe say Ruby or asp.net MVC if you actually have a lot of data fields to display, want to make them editable/insertable/deletable, or have multiple tables.

    41. Re:Huh? by KingMotley · · Score: 1

      Well if all your dependencies have a 1 to 1 relationship, you've overdesigned a simple task and probably isn't very large. On the other hand, if you have a large complex chain of interdependencies and claim that it doesn't lend itself well to parallel compilation, I suspect you don't know what you are doing.

    42. Re:Huh? by KingMotley · · Score: 2

      You are obviously a free thinker shill. Go back to your free thinking and let us get back to the regularly scheduled bashing of everything related to corporate, government, or anything else a 13 year old boy doesn't fully understand yet.

    43. Re:Huh? by Anonymous Coward · · Score: 0

      Sure Java can because you didn't even mention using profile directed optimizations. In Java, you can write brain deadcode, and the JIT will automatically handle all of the inlining, and taking advantage of branch prediction statistics. It'll figure out that you only have one class which implements an interface loaded, and automatically inline "virtual" methods (it also has an optimization for when you only have two different versions, but three it goes back to the slow path).

      Now, C++ will crush Java when you're dealing with L1 cache effects, because you can control the memory layout and you can avoid having to chase pointers in critical data structures. C++ will also crush Java when you start using SSE instructions. But the things you're talking about Java vs. C++ are places where C++ is actually in a worse position than Java is from many perspectives. I mean, Garbage collection... err, I mean "zone based memory allocation" when they do a similar analog in C/C++ is actually much faster than than tracking individual blocks of memory. There's a reason Apache httpd and other big projects started using that style of memory management.

    44. Re:Huh? by Anonymous Coward · · Score: 0

      Or, you know, any other language.
      PHP is easy*, it isn't fast. Not without hacking it to bits and making all that "ease" disappear. (like Facebook devs have seemingly done, even though Facebook is still quite terrible often)
      PHP is painfully slow in comparison. Like, seriously. JavaScript is faster now for managing chunks of data.
      And when you are looping through large amounts of data, still considerably faster. It is almost embarrassing.

      * if you use libraries and don't ever try touching the code because it will just screw you over at some point and make you rip your eyebrows out with sheer finger force.
      Not to mention the 15 gigatrillion stupid bugs it has due to (its new) developers not understanding very VERY SIMPLE concepts and abusing the term "weakly typed" to mean "we suck at fixing terrible bugs so yeah that is our excuse".
      That one in particular was a real annoyance to me, I spent around a month on and off wondering why the hell my code wasn't working, changing things in the time I had. Then I finally found out it was because PHPs terrible handing of data, not my code at all. I'm not changing my code to appease terrible non-standard interpretations from a bunch of morons. I deleted it and switched.
      The fact that even one of the ex-senior devs insulted PHP and its new current developers says wonders about the language.
      I'd rather use Bracket Vomit (Perl) than PHP. New nickname is patent pending, no steal pls.

      PHP should be forked, or killed. It it like 4chan now. Slow, terrible, and somehow acceptable now.
      It was never meant to be like this. It was a nice idea, but PHP is truly one of the best examples of what happens when Open Source Goes Wrong.
      A project that gets so popular it gets absolutely nooby developers on board and pushes out all the good developers is a very sad thing indeed.

    45. Re:Huh? by MatthewNewberg · · Score: 1

      Go ahead and try those suggestions with something like Chrominum. https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/c16gosC3wm8 If your suggestions are true, a lot can be gained. If you are suggesting not using stl, or boost, what do you want people to use? There is overhead with doing large projects with C++, but as far as I have seen C++ is still the best way to write performance intensive code.

    46. Re:Huh? by Anonymous Coward · · Score: 0

      What about Apples Automatic Reference Counting approach?

      That seems to work quite well.

    47. Re:Huh? by Anonymous Coward · · Score: 0

      Memory management is not a even a little bit of a problem in C++ if you are doing it correctly. Here's a hint: If you have new/delete more than a few places anywhere in your code, you're almost certainly doing it wrong. Pointers are also generally not necessary for most things. Everything you use in C++ should be constructs that clean themselves up when they go out of scope. Example: You should never use arrays created with new. Use std::vector instead. I haven't had a single memory leak with my C++ code in years. I simply write the code so that it is not possible. In Java, I've had numerous problems with leaks from streams, bindings, and other things that don't clean themselves up properly.

    48. Re:Huh? by Darinbob · · Score: 1

      This is somewhat right and wrong. I think you mean some language IMPLEMENTATIONS are faster or slower than others. At their heart, there is nothing inherently slower about Java or Lisp or Perl than C. It's just that people deal with somewhat simple implementations. It's easier to create a simple C compiler that beats the pants off of a simple Java byte code interpreter. Actually in some cases the languages or features that some people consider inherently slow can be extremely fast or improve overall performance, such as garbage collecting (people remember the abysmal pauses in old Franz Lisp or the default Java VM and conclude that it is destined to be slow). Some of the tradeoffs are really size and space over speed as well.

    49. Re:Huh? by Darinbob · · Score: 1

      Consider GCC C versus GCC C++ on the exact same file with no headers. The C version compiles noticeably faster.

      There are sometimes basic things that can be done that many programmers don't bother with. Maybe they've never experienced the annoyance of an 18 hour build, or remember planning their compiles so that they overlap with lunchtime. Ie, in C/C++ if you just use a pointer to a structure, you can just declare the structure rather than including the header file that defines it fully. Sure it seems simple and seems to save only a trivial amount of time; but in a big project you can have a huge spiderweb of header file dependencies causing them all the be loaded and compiled for every file. Similarly for those using templates, putting the entirety of a large function inline inside a template means a slow compile (as well as making it very difficult for the linker to detect what is essentially duplicated code).

    50. Re:Huh? by Darinbob · · Score: 3, Insightful

      Garbage Collection with a bad implementation this is true. But garbage collectors do not need to cause non-determinism; they can be used even in real time systems. The problems is that people re-invent the wheel and don't learn from all the research in the past that sped GC up. Or more likely, the system was originally designed to be a simple quick-and-dirty scripting language but its scope has grown so that now the hastily written GC is unsuitable for the new requirements.

      To be fair, good GC is hard, and it is extremely difficult to do it portably. Some good GC techniques need hooks into the operating system (ie, you want to mark pages as clean or dirty). Doing this portably sometimes means you see implementations that sit GC up on top of malloc, so that GC is merely a way to eliminate manual allocating and freeing, and you end up with performance headaches with memory fragmentation.

      Yes it's true, if you use a malloc and free directly and no GC, you can still end up with non-deterministic allocation performance! Especially with a naive malloc I see used a lot on small systems, where you just have a linked list of available regions so you have a linear search to find regions big enough. And you end up with fragmentation on any system that does not have relocatable memory (ie, most traditional non-interpreted systems), so many embedded systems prefer to use memory pools to fix those problems.

    51. Re:Huh? by Anonymous Coward · · Score: 0

      Example: You should never use arrays created with new. Use std::vector instead.

      WRONG!

      Never use a vector for an array that doesn't change size.

    52. Re:Huh? by Darinbob · · Score: 1

      Depends on the language. If your GC is just a replacement for large grained new/delete then that's practical. But for some languages you will exhaust all memory in minutes because they're designed around GC and every operation involves implicit allocations. Ie, Scheme, Haskell, Smalltalk, etc. There GC is running all the time It's also where a naive garbage collector will result in very large pauses, which gives some people the incorrect notion that GC is inherently slow.

    53. Re:Huh? by Anonymous Coward · · Score: 0

      Talk about making someone else's point, considering Java didn't have anything template-like for ages. Also, try using e.g. clang. It is much better at giving useful errors.

    54. Re:Huh? by 0123456 · · Score: 3, Insightful

      At the end of the day with C/C++ you have to deal with memory management and that's just one additional piece of work that you don't have to be so concerned with with Java.

      You're funny.

      I think we have about a dozen calls to new and free in a few hundred thousand lines of code in our server. The vast majority of memory allocation in C++ is hidden in libraries like STL, which we presume have been debugged.

      In Java, on the other hand, you have to be very careful with memory management or you'll either end up pausing for long periods for garbage collection or crashing with out of memory errors. Instead of worrying about whether people remember to call free after allocating something, you end up putting in caches so you can reuse objects rather than reallocate them. We've used some Java libraries designed for high-performance financial uses and they try very hard not to allocate any objects that they'll later need to clean up.

      Programmers believing that 'you don't have to worry about memory management in Java' is the reason so many Java programs are a slug-like mass of memory bloat.

    55. Re:Huh? by Jmac217 · · Score: 1

      There is nothing wrong with PHP, it is just obviously not for you. Yes it may be clunky and slow and you may have 10 better languages in mind, but it has most things you'd need to use baked into it. There is no reason to bash any language, just don't use it if you have a "better" option in mind. I personally love PHP, but that doesn't stop me from experimenting with anything else I find. I find your outlook off-putting.

    56. Re:Huh? by Joce640k · · Score: 1

      Some languages allow you to write programs more quickly than other languages.

      The difference between Java and C++ is minimal.

      --
      No sig today...
    57. Re:Huh? by Anonymous Coward · · Score: 0

      a C++ program requires the coder to write more lines of code to do a specific task. All of the languages have to do those tasks, but C#, java, and others of that ilk hide it away behind automated processes. It is therefore quicker to write applications in java than in C++ if the developers are of comparable skill. Even if they are not of comparable skill a semi-decent java developer will crank out a medium-large sized application faster than a skilled C++ developer. The difference might not be vast, but could be measured in the 1/2 day to 1 full day timeframes these sorts of applications are expected. A java developer can write a program that earns money a day faster than the C++ one would. That's millions of dollars, so I agree in this case that it makes more sense to go with a slower running application if that is the focus. Why not, though, use C# to write the fluff and then go unmanaged with C++ for the performance-intensive algorithms? Is it a case of not enough developers knowing both?

    58. Re:Huh? by Anonymous Coward · · Score: 0

      you lost me at "Visual C++" and "compile quickly"

    59. Re:Huh? by Anonymous Coward · · Score: 0

      You've got to be kidding, g++ on liinux compiles orders of magnitude faster than visual studio on windows.

    60. Re:Huh? by Anonymous Coward · · Score: 0

      It was just a bunch of assertions ...

      So you're saying the article was written by C++ programmers?

      ... many by people who have a vested interest in the use of Java.

      Alright, now I'm almost positive that's what you meant.

    61. Re:Huh? by RR · · Score: 1

      in Python... several minutes later it became obvious that I would need something faster. Ported the code over to C++, I think it finished in about 90s.

      The obvious solution is NumPy & SciPy. Get much of the ease of programming in Python with the speed of optimized C.

      --
      Have a nice time.
    62. Re:Huh? by Anonymous Coward · · Score: 0

      For the last 7 years did a lot of real-time software on Java and performance is the ONE thing that is NOT the problem with GC in Java. There are quite a few others, for example: bugs in GC, people's lack of understanding how it works so they end up misusing the heap, or misusing the finalizers, automatic GC makes it hard to trace down memory leaks because you may have to deal with a pile of stale objects on the heap which are not part of the leak.

      But performance and real-time behavior are quite easily achievable, and not having to repeatedly code heap management is a huge time-saver in development. Average C++ program will typically contain thousands if not millions of places where the programmer has to manually make sure that the heap is managed properly. Most of them have to follow exact same pattern and in vast majority of cases none of the stuff you complain about is of any factor whatsoever so spending programming time on debugging this stuff is just a gigantic waste of money. Not mentioning the fun part where someone passes a pointer incorrectly, ends up corrupting the heap structures, and the bugs comes out as something completely unrelated after several hours of runtime later - yeah, that part is not really fun at all.

    63. Re:Huh? by jma05 · · Score: 1

      > If I want to write a program quickly, I write it in Python even though I know the program will run quite slowly.

      Most of the times I write in Python, I know that the program will run almost as quickly as native code for practical purposes, since for most of the common cases that need fast code, a native extension module is already readily available - so its just a little call overhead that is extra. In my 12 years of Python use, including processing large amounts of research data, I rarely needed to even use Cython. Of course, YMMV.

    64. Re:Huh? by Ungrounded+Lightning · · Score: 1

      At the end of the day with C/C++ you have to deal with memory management and that's just one additional piece of work that you don't have to be so concerned with with Java.

      You're funny.

      I think we have about a dozen calls to new and free in a few hundred thousand lines of code in our server. The vast majority of memory allocation in C++ is hidden in libraries like STL, which we presume have been debugged.

      It usually turns out that there's an obvious place to free the memory algorithmically. C++ has helpful tools to let you build your memory management into the objects themselves, so it happens automagically.

      It's only when you have to generate persistent mutating structures that things get complicated

      C++'s paradigm is that the programmer, who understands the algorithm, is usually more clueful about when the memory should be freed (or examined to see if it should be freed) than a general purpose component which, while it always gets it right, has to look at EVERYTHING rather than just the problem objects.

      Having said that, it's quite possible to build garbage collection into into C++ objects. (The Xanadu project was able to do it in the late 1980s, when C++ was still in diapers.)

      But a bit of personal sour grapes: It would be a LOT easier if the standards committee would fix the member object constructor timing issue (as I asked them to do in each of the first two rounds of standardization.) Then heap-allocated, garbage-collected, classes could be as general as other types, including all their related components in a single block of allocated memory, rather than being limited to not having full-blown object members with error-throwing or garbage collector triggering constructors, leading to the necessity of replacing such members with pointers to another heap-allocated class instance.

      --
      Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    65. Re:Huh? by Anonymous Coward · · Score: 0

      Uhm - 3 questions:
      - what does date/time manipulation have to do with IDE?
      - from my experience .NET sucks at date/time/timezone stuff way more than Java (primarily because it's so Windows-centric and Windows isn't that good at it in the first place) so where did you get this idea that C# has anything on Java regarding that?
      - did I miss something or is C# more like Java than C++ so what does your argument say in this case?

    66. Re:Huh? by Anonymous Coward · · Score: 0

      There is nothing wrong with PHP

      Yes it may be clunky and slow

      I would say those two qualify as things wrong with PHP.

      There is no reason to bash any language.

      It's not bashing if the critique is actually valid. Not all languages are created equal, just look at pretty much any "esoteric" programming language. While you can write every program in every Turing-complete language, and "better" is largely a question of priorities, some languages are objectively worse. PHP is one of them.

    67. Re:Huh? by NeoMorphy · · Score: 1

      Manual memory management is a whole class of bugs that Java doesn't have to deal with. A good C/C++ programmer shouldn't have *that* much difficulty, but it does add to debugging costs and detracts from mental focus on the algorithmic aspects of the problem.

      It doesn't "detract" from my mental focus at all.

      Instead, I view memory management as an integral part of the algorithm design.

      When you used the phrase "algorithmic aspects of the problem" you seemed to imply that memory management is divorced from that, and that memory management is something to be separately designed and bolted on later. That is a very unwise approach.

      I have found the best approach is to take memory usage into consideration as you do the algorithm design. Often, it simply means having a good understanding of when objects come into existence, and when they go out of existence. For me, taking such things into consideration doesn't "detract" in any way from solving the problem. In my view, efficient use of memory is just another goal of the algorithm design.

      Well said! I was starting to wonder if most developers thought that memory management was someone else's problem.

      Maybe it's because I started coding when memory was very scarce, but I hate it when developers go crazy on memory usage. I remember having to code under the restraint of a 286 dos extender. Sometimes a module would grow beyond the 64K limit and I would have to break some of it out into another module. The 386 was incredibly awesome compared to that!

    68. Re:Huh? by Anonymous Coward · · Score: 0

      Basically, you're saying: conservation of time applies to software.

      You either spend more time writing code (asm, c, c++, etc...) or spend more time in runtime (Java, C#, etc...). Basically not solving the problem but shifting it to another place.

    69. Re:Huh? by lannocc · · Score: 1

      and it gets the job done as fast as a shell script.

      In other words, shell scripting needs to move to the web. I am working on making that happen: http://iovar.com/

    70. Re:Huh? by Anonymous Coward · · Score: 0

      And I suspect you have no idea what a chain of dependencies looks like for, say, an operating system. Or flight control systems. Or large trading systems.

      If you think the solution is "LOL JUST THROW FASTER DISK AND MORE RAM AT IT," then you don't know what the fuck you're talking about, and we can completely disregard your contributions to this conversation.

    71. Re:Huh? by Anonymous Coward · · Score: 0

      Awwwwwwww... diddum h4rr4r get served?

      Nice response, fucktard. Thanks for confirming that you have no idea what you're talking about.

    72. Re:Huh? by manu0601 · · Score: 1

      My little experience of this environment is rather: server is crashing? Add more servers.

    73. Re:Huh? by Anonymous Coward · · Score: 0

      Dumb.

      I write in C, it allows me to write programs quickly that also run quickly.

    74. Re:Huh? by devent · · Score: 2

      What hinders you to use Joda Time if you think that Java's data and time are insufficient?
      Any non-trivial application have dozens or more dependencies, one more or less really is not important.
      I find the strength of Java is the enterprise grade open source libraries, one for every possible scenario.

      --
      http://www.mueller-public.de - My site http://www.anr-institute.com/ - Advanced Natural Research Institute
    75. Re:Huh? by Anonymous Coward · · Score: 0

      You can accomplish the same thing by using C++ and never calling free or delete. I'd imagine your performance would still be better than Java. At the end of the day, just kill the process.

    76. Re:Huh? by non0score · · Score: 1

      Yeah, it's possible (I worked on AAA games with a few million lines of code). In VS, take your whole code base, flatten to one project, make 4 (or any small number) new .cpp files and alternately include all other SOURCE .cpp files into these (and disable all compiling on all other files in this configuration). Each file will take about 30 seconds to compile...but you have 4+ cores, so it takes 30 seconds to compile all 4 files. Linking is much faster too. This was done because linking on the PS3 used to take 20 minutes (this was within the first year of the console's release).

    77. Re:Huh? by MindStalker · · Score: 1

      I'm glad someone noticed my shell analogy there.

    78. Re:Huh? by Skapare · · Score: 1

      One problem is lack of shared memory of the code. The JVM file could be shared if done via read-only memory mapping. But then JIT compilation has to work on the side, not in-place. And processes can't share their JIT results, so Java has to depend more on threads.

      --
      now we need to go OSS in diesel cars
    79. Re:Huh? by Skapare · · Score: 1

      Good C programmers have this already worked out into their common patterns.

      --
      now we need to go OSS in diesel cars
    80. Re:Huh? by Xest · · Score: 2

      But that's the point isn't it? Sometimes those hits from the garbage collector simply don't matter and if they don't matter because performance in this respect isn't the greatest concern then you don't have to bother yourself with it, whilst in C++ you have to bother yourself with it whether performance is a concern or not - in other words C++ always has an inherently slower time to market because of this inherent underlying trait and that's the point of TFA.

      If optimisation is more important than time to market then you're absolutely right, switch to C++ because then Java's time to market advantage might be lost.

      It's about trade-offs and as I said, sometimes C++ is the right choice, sometimes it's Java, but your anecdote is merely a single case where C++ is the right choice not Java, a single anecdote doesn't disprove Java's worth for every case though.

    81. Re:Huh? by david_thornley · · Score: 1

      That looks like optimizing for compile time at the expense of developer time, since you're throwing away a lot of modularization/encapsulation/organization. It seems to me that compile time is part of developer time, and therefore this is probably a losing strategy. Anybody have experience working with similar projects that were compile-time-optimized versus conventionally laid out?

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    82. Re:Huh? by Rakishi · · Score: 1

      No, some languages simply are slower to develop with and debug. The problem is also made worse depending on the frameworks and IDEs available. As an example, you're going to get your work done way quicker writing an application manipulating dates and times using C# and Visual Studio than you are Java and Eclipse because until Java 8 Java's date time functionality is shit and Eclipse is a dog slow IDE. With Java 8 and say NetBeans or JDeveloper though things will be pretty similar.

      Java (and say Maven) makes it trivial to use third party libraries. A few minutes and Joda time is installed, seen by the IDE and properly distributed within any jars I make. I guess C# users are forced to deal with only the built in libraries but that's very much not the case for Java.

      Also if you want a good IDE for Java then you buy Intellij IDEA and call it a day.

    83. Re:Huh? by Anonymous Coward · · Score: 0

      Lets then hope they don't use the same servers to do pricing of anything for the next day.

    84. Re:Huh? by Xest · · Score: 1

      "Java (and say Maven) makes it trivial to use third party libraries. A few minutes and Joda time is installed, seen by the IDE and properly distributed within any jars I make."

      Maven is far from flawless. I had a number of versioning issues with it earlier this year (specifically it was caching old versions and not updating, causing compile failures) and it doesn't work well with proxy servers that require authentication for example. You also need to know what the name is of what you're looking for which can require additional Googling - it's certainly not intuitive. When it's working it's painless though I agree, but the point is it's still extra work and still an extra place where problems can arise and the longer that can be avoided by having decent core libraries the better. The benefit of .NET in this regard is simply that it's DateTime handling methods are excellent enough to not require you to go fishing for third party solutions.

      "I guess C# users are forced to deal with only the built in libraries"

      Don't be silly, you just right click, click add reference, and select the reference if you already have a library to reference. As of 2012 though they have NuGet which does everything Maven does but with a built in package browser from a central repository with an exhaustive list of libraries (including FOSS libraries).

      "Also if you want a good IDE for Java then you buy Intellij IDEA and call it a day."

      I agree it's very good (about a thousand fold better than Eclipse for example), but Visual Studio certainly still has the edge.

      I work on C#, Java and C++ projects FWIW so I do have the benefit of experience with all three in quite some detail.

    85. Re:Huh? by non0score · · Score: 1

      If anything, you are enforcing better modularization/encapsulation/organization. You're forced to not use anonymous namespaces, because then all the symbols clash. You HAVE to put everything into their own namespace.

      And I'm not sure how you think this is a losing strategy. If you've worked on large projects, link time becomes a PITA partly because of the number of files involved. There are tools out there that took 30 minutes to link when there are a ton compiled files. When you drop that number down to 4, it links in mere minute or two. Also, compile time takes a dive (in a good way) -- instead of each .cpp and .h file opening up all their includes, you get just four .cpp opening up includes (can't avoid the .h includes). So instead of taking 2 seconds per file to compile 2000 files (plus a long link time), you take like 5 seconds per file to compile 4 files (plus a short link time). Any way you slice it, it was a boon to productivity for our team.

  4. memory monster by Anonymous Coward · · Score: 0, Interesting

    You forgot to mention that Java programs don't even compare to C/C++ in terms of memory usage. Past 10 years didn't change that.

    1. Re:memory monster by bunratty · · Score: 2

      It's a good thing that these days computers have plenty of memory. It's not quite yet true on smaller devices such as smartphones, but it will be soon. With each year, memory use is becoming less of a problem and how to take advantage of parallel processing is becoming more of a problem.

      --
      What a fool believes, he sees, no wise man has the power to reason away.
    2. Re:memory monster by Minwee · · Score: 4, Insightful

      Traders are typically working with monster servers outfitted with over a hundred gigabytes of RAM, not tiny desktop workstations that need to swap just to move the mouse. I won't say that memory usage is no object, but there is almost no reason not to throw extra memory at a process if it wants it.

      Your trading engine runs in Java and leaks four gigabytes an hour? No problem. Just give it 64G of stack and do half an hour of garbage collection after the market closes. Is that not enough? Okay, give it more. Don't have that much available? Get more. Can't afford it? Now you're just pulling my leg. Buying extra memory is cheaper than debugging a live system where any slip-up could cost you thousands of dollars in missed trades or penalties.

      It's a weird world, but somehow it works that way.

    3. Re:memory monster by LostMyBeaver · · Score: 1

      Poor code uses a lot of memory in any language.

    4. Re:memory monster by scamper_22 · · Score: 4, Insightful

      It's hardly a weird world.

      Water leaks into basements. Many times, the solution is to use a sumppump to pump the water out rather than a very costly rebuilding of the house and surrounding terrain.

      I've bought many products in my life (just recently a car tire pump) that tells you not to run it for more than 15 minutes. It might over heat.

      Many people have cars that start leaking oil as they age. They don't spend the money to fix it as long as they can just add enough oil to keep it going.

      And who hasn't used duct-tape to seal leaks?

      It's hardly a weird world out there.

    5. Re:memory monster by Time_Ngler · · Score: 2

      C/C++ is much more prone to memory leaks than Java. Yes, you could chase them all down but this takes time. For a long running process this is definitely a factor.

    6. Re:memory monster by Anonymous Coward · · Score: 0

      Yes, but in some languages like Java it is hard to tell good code form bad.

      Other languages like VB encourages bad code.

    7. Re:memory monster by Anonymous Coward · · Score: 0

      No, Minwee had it right. It IS a weird world. Weird and wonderful.

    8. Re:memory monster by Minwee · · Score: 1

      When your car breaks down and you need to use duc[kt] tape to hold it together, maybe you're a bit late in getting home that day.

      When the systems which run the world's financial markets are treated the same way... well, just open your window and take a look outside.

    9. Re:memory monster by BlackHawk-666 · · Score: 1

      Good code doesn't ever leak any memory. Leaking 4gb / hour would be atrocious code! Learn to use code profilers.

      --
      All those moments will be lost in time, like tears in rain.
    10. Re:memory monster by Anonymous Coward · · Score: 1, Interesting

      I work in the finance industry in London on systems written in Java. and this comment is completely misleading.

      First of all, ANY memory leak discovered in this kind of critical Java code is found during testing, using JVM profilers such as this : http://docs.oracle.com/javase/6/docs/technotes/guides/visualvm/profiler.html and is considered a major problem, and a lot of high priority effort is focused on fixing it. Believe me, the "no problem just throw gigabytes more memory in the server" is NOT an acceptable solution - the JVM performance deteriorates as you start to let the heap size grow too high, indeed if Garbage Collection starts at these kind of sizes it can slow to completely unacceptable speeds. It's actually more sensible to let garbage collection run fairly regularly to keep the memory usage limited, and with modern multicore servers you don't notice any penalty for it.

      The JVM on the IBM servers these large organisations use is also super optimised for the specific chip sets in the servers - the performance is in a different league altogether to the bog standard Oracle version on your PC.

    11. Re:memory monster by DamonHD · · Score: 1

      Rather depends on your definition of 'leak' and what you happen to be doing...

      Rgds

      Damon

      --
      http://m.earth.org.uk/
    12. Re:memory monster by ebno-10db · · Score: 1

      Your analogies are a resounding endorsement for the use of Java in these applications. Sure it's always breaking, but we have sump pumps and duct tape!

    13. Re:memory monster by jkflying · · Score: 1

      Well, you could always just buy a new house. And hope it isn't haunted.

      --
      Help I am stuck in a signature factory!
    14. Re:memory monster by Anonymous Coward · · Score: 0

      That's not exactly a Java specific solution.

      I could just as easily:

      sed -i 's/free();//g' *.c

      and remove all the heap returns from my C programs, and exit() the program at the end of each trading day.

      In fact this 'solution' also removes any problems arising from free()ing any objects that are still in use and subsequent corruption that arises.

      Incidentally, I disagree with your premise that HFT wonks have unlimited budgets, you can't spend more on an algorithm than it will earn, that wouldn't make commercial sense, and as the algorithms are competing against other wonk's algorithms, things you can do to decrease runtime cost of an algorithm and increase it's probability of survival. Yes they are spending a lot of money, but they are also running a lot of competing algorithms, and the bad ones are going to get discarded.

    15. Re:memory monster by Skapare · · Score: 1

      Throw more RAM at it. Allocate a little swap space in ramdisk so a few programs that go nuts when there is no swap will be quiet. It's only money.

      --
      now we need to go OSS in diesel cars
  5. No! It can't be! Java is slow, I tell you! Slow! by Anonymous Coward · · Score: 0

    Those people who have moved from Java to JavaScript by way of Ruby say that Java is slow, even slower than JavaScript. It must be true. They wouldn't be lying or misinformed, would they?

  6. Erm... by Anonymous Coward · · Score: 0

    if you take two software engineers, one for java one for C, which both are the best experts in their language inthe world... C will be faster.

    Using Java is just a trend, because the lack of C knowledge.

    1. Re:Erm... by Anonymous Coward · · Score: 0

      Using C is just a trend, because of lack of assembler knowledge.

  7. The advantage of Java -tm by Anonymous Coward · · Score: 0

    ... is that you get to rewrite your applications in 2 years? Or less?

    1. Re:The advantage of Java -tm by RabidReindeer · · Score: 1

      ... is that you get to rewrite your applications in 2 years? Or less?

      You're thinking of Microsoft.

      Java is the only programming language I have run across in common usage that incorporates a deprecation mechanism.

      When code becomes obsolete, you can tag it as deprecated. It will produce warnings when compiled, IDEs and javadocs will highlight it as deprecated, but it continues to be usable. That means that you can delete the code at your leisure instead of being forced to confront - and fix/bypass broken code when you're doing a completely unrelated emergency repair the way that I had to do far too many times using Microsoft C.

      Sun has been extremely conservative about pulling deprecated functions. The Date(month, day, year) constructor has been deprecated for more than a decade, having been pulled because of its inflexibility in regard to timezones and other locale sensitivities. But applications that were coded to use it continue to compile and run to this very day.

      Microsoft, on the other hand, yanked an entire SOAP library out from under me while I was still Beta-testing once.

    2. Re:The advantage of Java -tm by Anonymous Coward · · Score: 0

      M$ may be the "Godwin example" of developer friendly practices, not a great comparison for teasing value out of the juxtaposition.

    3. Re:The advantage of Java -tm by Anonymous Coward · · Score: 0

      Speaking of Microsoft: in C# (or another .NET language) the Obsolete attribute will do exactly that.

      [System.ObsoleteAttribute("Use X instead of Y", false)]

      The (optional) boolean flag indicates whether the deprecated code is an error (true) or not (false).

    4. Re:The advantage of Java -tm by FreelanceWizard · · Score: 1

      In .NET, you exactly have the same thing: ObsoleteAttribute. It's not often used, but it does exist.

      --
      The Freelance Wizard
    5. Re:The advantage of Java -tm by RabidReindeer · · Score: 1

      In .NET, you exactly have the same thing: ObsoleteAttribute. It's not often used, but it does exist.

      The cynic in me notes that one of the reasons .Net even exists is that Microsoft's attempted hijacking of Java was quashed. So, one could suspect that they may have lifted the concept from Java.

      But if it made the Microsoft world a better place, that's fine by me.

  8. Yes by AdmV0rl0n · · Score: 0, Troll

    Thats exactly what I would do. I'd take the most insecure, badly run, malware and virus vector based language and embed deeply in sensitive and financial systems.
    Why not? What can possibly go wrong.

    I wonder when Java will be able to be updated by an admin account via a standard user account on Windows. But then I wonder when Oracle will wake up and smell the coffee.

    --
    We`re all equal .. Just some of us are less equal than others.
    1. Re:Yes by bunratty · · Score: 3, Informative

      Java is far, far safer than C++. C++ does not enforce type safety at all. For example, in Java you cannot possibly have a buffer overrun or access freed memory as you can in C++. I think most of the security notices are about C and C++ programs, not Java programs. I think you're referring to the Java runtime, which is written in, you guessed it, C.

      --
      What a fool believes, he sees, no wise man has the power to reason away.
    2. Re:Yes by TemporalBeing · · Score: 0

      Java is far, far safer than C++. C++ does not enforce type safety at all. For example, in Java you cannot possibly have a buffer overrun or access freed memory as you can in C++. I think most of the security notices are about C and C++ programs, not Java programs. I think you're referring to the Java runtime, which is written in, you guessed it, C.

      Yet it is Java that has had its run-time environments pulled for security concerns.

      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    3. Re:Yes by Anonymous Coward · · Score: 1

      Well, let's think about the equivalent of pulling the Java run-time environment for C/C++. That's right, you'd have to pull your operating system. Do you see how that's not even close to a reasonable comparison?

      Not only that, but you're not even talking about related types of safety. The Java runtime keeps getting in trouble for poorly handling malicious third party code. If you are writing a java program yourself, it is immensely safer for the reasons GP listed, and you probably aren't in the business of attacking yourself with malware.

    4. Re:Yes by Anonymous Coward · · Score: 0

      The security problems of Java have absolutely NOTHING to do with the language itself and EVERYTHING to do with the fact that at some point in history some people thought it would be a useful feature to allow programs distributed over the internet to run automatically on people's computers, leaving all security on the flimsy trust that this "perfectly clean, secure and defect-free sandbox" would be possible to write in reality.

      Would you claim C++ as an "insecure" language if I asked you to set up a web browser that ran some kind of minimal virtualized environment where embedded conventional, compiled c program binaries could be run in? Or when this virtual enviroment leaked because no one was smart enough to not leave bugs in there that let the security be breached?

    5. Re:Yes by elfprince13 · · Score: 2

      For applets in a web-browser. Running a Java server is a different beast with different concerns.

    6. Re:Yes by RabidReindeer · · Score: 1

      Java is far, far safer than C++. C++ does not enforce type safety at all. For example, in Java you cannot possibly have a buffer overrun or access freed memory as you can in C++. I think most of the security notices are about C and C++ programs, not Java programs. I think you're referring to the Java runtime, which is written in, you guessed it, C.

      Yet it is Java that has had its run-time environments pulled for security concerns.

      In perspective, the RTEs have been pulled because they had flaws that enabled exploit code to be run. In C, the RTE lets ANY code be run, including exploits, so what's really happening is that Java is falling back to something closer to C levels of runtime security.

      The reason for the concern about Java exploitability is that while most sane people have long since given up on download-and-run C code (ActiveX), Java applets (while comparatively rare) have not had exploit concerns until fairly recently. Because until recently, Java's sandbox was considered trustworthy. C/C++ doesn't have a sandbox.

    7. Re:Yes by serviscope_minor · · Score: 1

      C/C++ doesn't have a sandbox.

      C/C++ doesn't have much of anything specified.

      There are various ways of sandboxing native code. On the heavyweight end you have something like a hardware assist, i.e. a hardware VM. You can then have things that go all the way down like software VMs, jails, sub-kernels, dynamic binary translation (like bochs, valgrind) to basic kernel based features like using rlimit and running as a nonpriviliged user or starting it in an SELinux/AppArmor context with no access to anything.

      On the other end, you have things like Google's NaCl which uses a subset of native code that can be verified to be safe.

      Naturally, just like java any of these sandboxes can be when bugs ARE found in the sandboxing mechanism.

      But it's perfectly possible to sandbox native code.

      --
      SJW n. One who posts facts.
    8. Re:Yes by Anonymous Coward · · Score: 0

      You're going to do it in Visual Basic?

    9. Re:Yes by TemporalBeing · · Score: 1

      Java is far, far safer than C++. C++ does not enforce type safety at all. For example, in Java you cannot possibly have a buffer overrun or access freed memory as you can in C++. I think most of the security notices are about C and C++ programs, not Java programs. I think you're referring to the Java runtime, which is written in, you guessed it, C.

      Yet it is Java that has had its run-time environments pulled for security concerns.

      In perspective, the RTEs have been pulled because they had flaws that enabled exploit code to be run. In C, the RTE lets ANY code be run, including exploits, so what's really happening is that Java is falling back to something closer to C levels of runtime security.

      The Java Run-Times were pulled because they were allowing exploits that were not necessarily related to the program being run.
      Comparatively, C/C++ programs are generally only susceptible to the flaws in the actual programs, and flaws in their support libraries are only exposed as much as the program allows it to be.

      The reason for the concern about Java exploitability is that while most sane people have long since given up on download-and-run C code (ActiveX), Java applets (while comparatively rare) have not had exploit concerns until fairly recently. Because until recently, Java's sandbox was considered trustworthy. C/C++ doesn't have a sandbox.

      C/C++ doesn't have a native, built-in sandboxing mechanism. But they can most certainly be sandboxed whether via hardware or software mechanisms.

      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    10. Re:Yes by TemporalBeing · · Score: 1

      Well, let's think about the equivalent of pulling the Java run-time environment for C/C++. That's right, you'd have to pull your operating system. Do you see how that's not even close to a reasonable comparison?

      True, you'd have to pull the OS for C/C++ when it is providing it dynamically. C/C++ programs (and any native code program) could be using the RTE statically - updating the version in the OS has zero impact on the actual program as it still uses the old version. That said, the C/C++ RTE does not in itself introduce security flaws into the programs that use it, which was why the Java RTE was pulled.

      Not only that, but you're not even talking about related types of safety. The Java runtime keeps getting in trouble for poorly handling malicious third party code. If you are writing a java program yourself, it is immensely safer for the reasons GP listed, and you probably aren't in the business of attacking yourself with malware.

      Yes, Java keeps getting in trouble for allowing additional code to interface with a program and extend the program in ways the author did not intend. Not possible with C/C++ without some major program specific cracking, and even then it's a program specific attack.

      Once in an extremely rare case does a bug in a C/C++ program translate in usuable ways to entire classes of C/C++ programs.

      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    11. Re:Yes by TemporalBeing · · Score: 1

      For applets in a web-browser. Running a Java server is a different beast with different concerns.

      The issue wasn't simply related to "applets for a web-browser". The reasons the Java RTE/VMs were pulled was due to how much it affected nearly every enterprise level use of Java in the data center - affecting entire classes of Java programs instead of having program specific attack vectors.

      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    12. Re:Yes by elfprince13 · · Score: 1

      [Citation needed]. I regularly see stories about nasty bugs in the Java plugin for web-browsers that allow drive-by downloads and code execution vulnerabilities. I've never heard of Java having to be pulled from a data-center. I'm not saying it isn't true, I'm just saying I'd like to see more info, because it's the first I've heard of this.

    13. Re:Yes by Anonymous Coward · · Score: 0

      This does not even make sense as a comparison to C/C++. The Java runtimes were pulled for not providing effective sandboxing, whereas there is no sandboxing at all built into C/C++. Effectively, in any situation where you were running arbitrary C code, it is at worst equally safe to run Java code, but likely far more secure to run Java since there can still be some form of security manager in place.

      How can you not understand this?

    14. Re:Yes by TemporalBeing · · Score: 1

      [Citation needed]. I regularly see stories about nasty bugs in the Java plugin for web-browsers that allow drive-by downloads and code execution vulnerabilities. I've never heard of Java having to be pulled from a data-center. I'm not saying it isn't true, I'm just saying I'd like to see more info, because it's the first I've heard of this.

      FYI - in the last year the Java JRE was pulled from all major platforms for at least a while. Quickest story I could find on-line is this one. It was reported on Slashdot back when it happened, and it wasn't simply the browser-plugins, but full JRE. Data centers would have been the most affected; they didn't necessarily pull it but they were under a lot of pressure due to the impact of the JRE vulnerabilities.

      The issues in play affected all versions of the JRE going back quite a while, up to and including the latest version at the time. In the last couple months there's been enough patches released to restore JRE functionality, but you have to be using the latest versions. Even then, Java's security perception has been shattered as a result.

      Also as a note, there were several rounds of major security issues for the JRE in the last year. They thought they got one fixed and another popped up.

      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    15. Re:Yes by elfprince13 · · Score: 2

      The article you just linked to is describing...wait for it...flaws in the security sandbox which is used for browser plugins. A standard JRE app is not sandboxed, unless you're using a custom ClassLoader for plugins or weird stuff like that. Can you give an example of a datacenter Java application where this would be relevant and how it would be exploited? Why a typical enterprise server app would be running user supplied .class files is beyond me.

    16. Re:Yes by robot_love · · Score: 4, Funny

      I got this one, boys.

      Let me translate what you said to a car analogy, then you can see if your statement still makes sense.

      "Your car is unsafe because it was recalled due to a seat-belt issue. You should ride a motorbike like me. It's never been recalled for seat belt issues."

      --
      .there is enough of everything for everyone.
    17. Re:Yes by TemporalBeing · · Score: 1

      The article you just linked to is describing...wait for it...flaws in the security sandbox which is used for browser plugins. A standard JRE app is not sandboxed, unless you're using a custom ClassLoader for plugins or weird stuff like that. Can you give an example of a datacenter Java application where this would be relevant and how it would be exploited? Why a typical enterprise server app would be running user supplied .class files is beyond me.

      Any data center app that works as a server. You would certainly be sandboxing stuff there too, for security purposes; just like you would want to sandbox Bind, Apache2, etc. The APIs listed as being vulnerable were not APIs limited to Browser Usage, though they were most likely most commonly used there.

      Why anyone would allow a user defined (end-user system defined) .class file to run on it is beyond me too...but that is part of the design of Java.

      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    18. Re:Yes by Anonymous Coward · · Score: 0

      Don't tell me you are confusing the Java browser plugin with the platform runtime? On Slashdot?

      Please hand your nerd credentials to the doorman on your way out...

    19. Re:Yes by GiganticLyingMouth · · Score: 1

      C++ does not enforce type safety at all.

      This is flat out wrong. If anything, via templates C++ has stronger type safety than Java does. Also, stack/heap smashing is orthogonal to type safety.

    20. Re:Yes by elfprince13 · · Score: 1

      Any data center app that works as a server....

      ...should be running on an operating system which is also correctly permissioned.

      Why anyone would allow a user defined (end-user system defined) .class file to run on it is beyond me too...but that is part of the design of Java.

      That's part of the design of every language. Nothing stops a C programmer from calling "execvp", or a Python programmer from calling eval(), or a PHP programmer from using unsanitized user input to build an SQL query, except common sense and good education. With most languages we call people who execute untrusted code "dumb" (or soon-to-be-unemployed). With Java we call them that too, but some people apparently still think it's okay. Oracle's guidelines point out that if you're relying on the SecurityManager, you're probably doing it wrong (their actual words are "should be scrutinized" and "considered a last resort").

      Can the Security Manager add a nice additional layer of protection if you use it correctly? Yes. Is it problematic that the Reflection APIs let you sidestep it? Yes. But if you're running Java in any kind of mission critical setting (i.e., enterprise/server apps), and that's all that stands between you and hostile code, you probably shouldn't have your job.

    21. Re:Yes by RabidReindeer · · Score: 1

      But it's perfectly possible to sandbox native code.

      Actually, I think the BSD crowd prefers the term "jail".

      The main difference between Java and native code is that in Java, there's always a sandbox. Native code either has to be self-jailing or some sort of jail has to be externally imposed on it.

      I'm not saying this to assert that Java is the One True Language, superior in every way to all others. I'm just being a pedantic little snot.

    22. Re:Yes by Anonymous Coward · · Score: 0

      FYI, Buffer overruns and freed-memory access are memory safety, not type safety. C++ is fairly type safe. http://en.wikipedia.org/wiki/Type_safety

  9. The new resume buzzword by Anonymous Coward · · Score: 0

    old: HFT
    new: MFT

  10. Re:Troll much, slashdot? by Anonymous Coward · · Score: 3, Informative

    Java can be compiled to native code.
    C and C++ can be interpreted.

  11. Re:Troll much, slashdot? by tonywestonuk · · Score: 4, Informative

    You do know that Java is compiled to native, don't you?

    The only reason Java is slower than C, is because C can have unchecked arrays, or low level access to CPU registers or vector SIMD.

    Given the same code written in both C and Java, and including C range bounds checking (to make it as safe as Java), the speed will be the same. Or, quite possibly Java would be quicker once the JVM starts stripping away the checks once it realises there is no possibilities of bounds been breached.

  12. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    > it is an run time interpreted language

    It isn't, check it out.

  13. LOL! by Anonymous Coward · · Score: 0

    Go Solaris : Erlang ;-)

  14. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    btw, java/c# nowadays are almost as fast / faster than c++ programs.

    http://stackoverflow.com/questions/145110/c-performance-vs-java-c

  15. Re:Troll much, slashdot? by bunratty · · Score: 1

    Languages are not interpreted or compiled. Implementations are compilers or interpreters. These days Java is typically compiled at runtime, instead of ahead of time. Your comment is bogus.

    --
    What a fool believes, he sees, no wise man has the power to reason away.
  16. Java's strengths are "not easy to ignore" by carou · · Score: 5, Funny

    Challenge Accepted!

    1. Re:Java's strengths are "not easy to ignore" by iggymanz · · Score: 1

      Java benchmarks always avoid the thing that makes java slower, mandatory use of heap and all the indirection for reference-semantics for user types. In other words, as soon as you start using many objects, java's performance goes into the crapper, especially using the standard EE libraries of the major vendors,

    2. Re:Java's strengths are "not easy to ignore" by Anonymous Coward · · Score: 0

      That's the problem with your POV..... the assumption that you have to create objects on the heap. Read Lawrey and others' work on the Disruptor pattern, and you can see that Java doesn't require you to do anything. It just makes using the heap much easier.

    3. Re:Java's strengths are "not easy to ignore" by iggymanz · · Score: 1

      the problem with your POV is that neither java server ee libraries nor 99.9999999999% of code out there use that idea, they use the heap. but I'm glad to hear Java applications are speed demons in the world between your ear and in ivory tower bullshit land.

    4. Re:Java's strengths are "not easy to ignore" by Anonymous Coward · · Score: 0

      Hey! 2003!! I missed you so much. It's been like.... 10 years? Wow.

  17. JAVA could be great if it lost weighrt. by sg_oneill · · Score: 4, Interesting

    The chest beating about Java vs C is kinda sad. Look, I've spent the past 20 years hating java with the fire of a 1000 suns, but having been kinda forced to use it lately I've realised its actually not a bad language, in fact its quite neat and well thought out (But god help me, somehow its date handling is even more broken than javascript)

    The problem is all the verbose cruft that goes with it. The giant overly complicated frameworks that require configuring 50 different XML files fed through a labrynith undocumented build process that allows you to write terse and insane pattern-madness code ....or alternatively just fire up JDBC and write a bloody SQL query instead.

    I think JAVA could shine if people just threw out about 15 years of insane and overly complicated frameworks and took some tips from the python and perl people and replace them with some simple but effective libraries that do one thing and do it well.

    But hey, at least its not bloody javascript!

    --
    Excuse the Unicode crap in my posts. That's an apostrophe, and slashdot is busted.
    1. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      You should try Dropwizard with a sprinkle of Guice (if you need Dependency Injection).

      If you are sick and tired of the behemoth that is Java EE or Spring, the simplicity of Dropwizard is just refreshing.

      http://dropwizard.codahale.com/

    2. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      The solution to your date handling madness: http://joda-time.sourceforge.net/

    3. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      Also have a look at Project Lombok http://projectlombok.org/features/index.html. Did wonders for me.

    4. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      Make sure your comparisons are correct. Using spring-core strictly for DI (with the options of annotations or XML or convention) is actually pretty lightweight and comparable to Guice.

      All of the bolt-on features of the Spring Framework are variably useful in an enterprise environment. @Transactional and the JMS bridges, for example, are extremely useful; some of the other bridges (like JMX bolt-ons), not so much. It's these other bolt-on features that Guice lacks.

    5. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      Yeah, people always hate that the most, which they understand the least...

      Like JavaScript. I'm a Haskell programmer, and I with the post-ECMAScript5 language extensions I like it more than the abominations that are C/C++.
      I consider C to be a utterly verbose ridiculously insecure boilerplate language for those that want or have to re-invent the wheel every damn time, and C++ a hellish nightmare that is just as insecure, even more verbose, a lot more ugly, with OOP force-sewed to the sow like it's freaking Frankenstein.
      And let's not even talk about the build systems. There's a special place in hell for those.
      People actually think JS is getting more like Python now. But actually Python just got more like Haskell. As did JS. And Ruby faps to Haskell every night anyway. ;)

      About Java, the language: I only dislike it because of its similarly to C/C++.
      About Java, programming in it: Yeah, it suffers from major enterpriseyness. Frameworks over frameworks... (a concept that itself by definition is deeply wrong and goes against the core programming principles in so many ways) ... "blueprints" full of "design patterns"... and... well, it seems like the whole ecosystem is designed by "enterprise" consultants. The worst kind. But that's not Java's fault.

    6. Re:JAVA could be great if it lost weighrt. by PurplePhase · · Score: 1

      You can thank the SpringSource people for that xml configuration POS.

      They even thought they'd make their own version of Rails (even they already have SpringMVC) and came up with Grails - which is actually much, much worse than you might expect when it *cannot* produce a stack trace less than 150 lines long, and it makes all the problems with all of their other frameworks (which Grails relies on, even though it is rumored to have been based on Groovy) that much worse - imagine the lack of implicit configuration and frameworks you've experienced so far, except that *if you're lucky* you get less informative error messages than you've seen before. Typically instead of that something simply doesn't work as you would expect and you have to research it for a couple hours (or in the case of one of my colleagues, a couple WEEKS) to figure out why it doesn't work. And then use Groovy to change class behaviour to work around SS's POS.

      Yeah, like that.

    7. Re:JAVA could be great if it lost weighrt. by PurplePhase · · Score: 1

      Joda is not the solution to anything, except another academic's ego.

    8. Re:JAVA could be great if it lost weighrt. by hedwards · · Score: 1

      Java has its issues, but ultimately, it's good at what it does. Trying to use the wrong language for the job is always going to end poorly.

      From what I've seen, most of the hatred for Java comes from people that are either fanboys or have been using programs that would have been better written in some other language.

    9. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      Or wait for Java 8 to come out, as it has a new date time system (which essentially "rips off" JodaTime, meaning it should be relatively easy to pick up if you have experience with that framework):

    10. Re:JAVA could be great if it lost weighrt. by Threni · · Score: 2

      Why don't you just use c# instead?

    11. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      Please suggest a better date library.

      Oh right, as crazy as Joda is, it is the best one out there. Dates and timezones are needlessly complicated, and it isnt Joda, Java, or any developer's fault. (Though, seriously, GregorianCalandar sucks ass.)

    12. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      As far as the date handling goes, take heart: JSR-310 (javax.time) arrives in Java 8, with a much better API. I think you can use it now.

    13. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      Why do you use those frameworks if they are shit and don't help you?

    14. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      There are plenty of great Java libraries and tools that make Java development a joy! However, way to few java professionals use them.

      I highly recommend the following.

      IntelliJ Idea
      Maven or Gradle
      Groovy
      Apache Commons
      Google Guava
      JRebel

      And for web development I think Grails is way way better than Django or Rails.

    15. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      I don't see why people have any problems with JS Date.

      I've even made my own date/time system on top of it for a game that I devhelled because lack of interest.
      Better yet, they are out of sync with real days and basically come in to around 7 hours real time for a game day.

      That barely took a weekend of learning both it and writing the new code.
      And that was forever ago when I never knew much, I could write it far quicker and easier now.

    16. Re:JAVA could be great if it lost weighrt. by Darinbob · · Score: 3, Insightful

      Yes, Java at its core is a simple language, with well understood concepts and features that people have been using for decades. But it's saddled with a huge amount of framework. To be a good Java developer these days doesn't mean knowing how to use Java the language, it means knowing all about the infrastructure and how to quickly tie together pre-existing functions to do what you want.

    17. Re:JAVA could be great if it lost weighrt. by codealot · · Score: 2

      Wow, this is new. A rational, reasonable argument from a self-described Java hater... not just another "Java is slow because it's interpreted" or "Java is insecure" bullcrap post.

      I've seen legions of developers grow frustrated with the gigantic frameworks and libraries that have grown up around Java, and react by abandoning Java and building something insanely simple in another language.

      I wish just one of those guys would have instead tried abandoning the bloated frameworks and instead build something insanely simple in Java. I've done that, and found it very satisfying. But I'm aware I'm firmly in the minority having tried that, and in more than one case some other engineer grabbed my small code and bloated it up again.

    18. Re:JAVA could be great if it lost weighrt. by intangible · · Score: 1

      Not that Joda isn't great, but generally Apache Commons' DateUtils provides most of what I need.

    19. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      I fully agree. Java is a great language, for most part, but it isn't used too well.

    20. Re:JAVA could be great if it lost weighrt. by sg_oneill · · Score: 1

      Because I have a job and don't always get to choose what junk senior management decides to inflict on the developers.

      --
      Excuse the Unicode crap in my posts. That's an apostrophe, and slashdot is busted.
    21. Re:JAVA could be great if it lost weighrt. by sg_oneill · · Score: 1

      I think part of what made django/rails/etc the sorts of frameworks that J2EE/etc SHOULD have been is their ability to utilize the dynamicness that the duck typing in python/ruby/etc provides that traditionally wasnt available or appropriate to javas striict typedness. I believe modern java has been addressing that, which is good because duck typing in the dynamic languages (python/ruby/etc) , whilst superior to PHP/Javascripts broken ass loose typing, still has a few traps that can be fallen into without religious linting and unit testing. Things might change, or they might not. Who knows!

      --
      Excuse the Unicode crap in my posts. That's an apostrophe, and slashdot is busted.
    22. Re:JAVA could be great if it lost weighrt. by dkf · · Score: 1

      Dates and timezones are needlessly complicated

      Blame politicians and physics for that. Politicians because they can't leave timezones alone or use consistent rules, physics because the natural relevant time units we're stuck with are genuinely horrible.

      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    23. Re:JAVA could be great if it lost weighrt. by bbsalem · · Score: 1

      It is Suns fault!

      I now prefer python, and even over perl. My biggest gripe with Java is the class libraries, their size and complexity, and I know that the reason is that in the early days Sun was doing PL/1 in C and trying to do class design by committee and please its corporate customers. Java is a disaster by design. A pox on it!

      I didn't reply to the head of this thread, but I think that programmed trading in financial markets has destroyed the safety of the world economic system and so squeezing performance out of Java so traders can play electronic speculators is not only beside the point, it is evil.

      If I were the SEC or a world market regulator I would ADD latancy to trades! I would make every electronic trade wait 30 seconds.

    24. Re:JAVA could be great if it lost weighrt. by Anonymous Coward · · Score: 0

      Actually, in the early days, the libraries were pretty great. Apart from suffering from the problems of single inheritance, forcing the natural graph into a tree. Then came the "consultants" with their Adaptors and Singletons and FactoryFactoryFactories in FrameworkFrameworks. ;)

      If I were the ruler, I'd make ALL forms of non-goods-trades punishable by staking. Especially anything involving interest. I mean, people got the damn Nobel prize for showing that stock markets that don't trade goods (like in the olden days, not like they are traded nowadays, as that's just as bad) can never ever ever work without guaranteed crashes every 30 years. And now those fascist (= corporate-state) fuckers created a system where they bottle up those crashes and act like they "solved" it. That's like putting a cork in your exhaust, and saying you made an emission-free car.
      It only means that if it bursts out, it destroys EVERYTHING. And what we saw since 2007 was only the first ripple of that. But I digress.

  18. From a sys admin's perspective by shuz · · Score: 1

    Java does NOT perform anywhere close to as efficiently as C/C++. You might be able to get message transmissions to take the same time, but the Java environment will undoubtedly take more system resources. The same happens with any through the kitchen sink of libraries at it interpreted language. .Net, Java, Ruby. In my experience Perl runs faster than those 3 but managers have been led to believe that Perl has a slower time to market, thus is slipping from the mainstream. The closer you get to stripped down, just what you need, compiled language, the faster and less system resources the code will take to execute.

    The big issue with language decisions these days is that they tend to be driven by perceived market value. People are the most expensive cost to most businesses these days. So the marketing battle between languages focuses less on performance and more on how experienced and expensive your developers need to be. What I see being missed with this marketing is that by lowering the people quality and marginalizing your language and code quality, you are setting yourself up for maintenance, improvement, and performance costs down the road.

    --
    There is or can be built a machine that can simulate any physical object. -Church-Turing principle
    1. Re:From a sys admin's perspective by RabidReindeer · · Score: 1

      Java does NOT perform anywhere close to as efficiently as C/C++. You might be able to get message transmissions to take the same time, but the Java environment will undoubtedly take more system resources. The same happens with any through the kitchen sink of libraries at it interpreted language. .Net, Java, Ruby. In my experience Perl runs faster than those 3 but managers have been led to believe that Perl has a slower time to market, thus is slipping from the mainstream. The closer you get to stripped down, just what you need, compiled language, the faster and less system resources the code will take to execute.

      The big issue with language decisions these days is that they tend to be driven by perceived market value. People are the most expensive cost to most businesses these days. So the marketing battle between languages focuses less on performance and more on how experienced and expensive your developers need to be. What I see being missed with this marketing is that by lowering the people quality and marginalizing your language and code quality, you are setting yourself up for maintenance, improvement, and performance costs down the road.

      Never trust the assertions of people who say "undoubtedly", "obviously", "just plain common sense", etc.

      A lot of "undoubtable" things are wrong. Especially when they're based on how things "should" be. Doubt. Measure.

    2. Re:From a sys admin's perspective by bws111 · · Score: 1

      The closer you get to stripped down, just what you need, compiled language, the faster and less system resources the code will take to execute.

      Which is exactly why modern, JIT-compiled Java can, and often does, outperform C.

    3. Re:From a sys admin's perspective by ebno-10db · · Score: 1

      Benchmarks?

    4. Re:From a sys admin's perspective by codealot · · Score: 1

      Perl faster than Java? Perl faster than .NET?

      You've never benchmarked any of these yourself, have you? (Please tell me you're not talking about benchmarking some "Hello World" application that can be measured in microseconds...)

      I won't go into details now, but Perl 5 is really *spectacularly bad* at runtime performance. Pretty much at the other end of the spectrum from C/C++/.NET/Java (all of which compile to native, whether ahead of time or JIT, and all of which perform in the same ballpark for typical applications).

    5. Re:From a sys admin's perspective by Anonymous Coward · · Score: 0

      C optimizer compilers do better job at that than java compilers, and much better than the top jit generators. In our internal migration from java to c++, our well tunned code bases using Exelcior Jet cant produce better metrics that our plain, nomral Digital Mars C++ version... and latter years we are mostly a java shop ( before we used to do embeded qnx in c++, but the demand dried in the locla market around five years ago )

  19. Question about the polls. by I'm+New+Around+Here · · Score: 1, Informative

    So now the polls are allowed to have comments, they are for data mining only, not discussion.

    Why?

    What is the reason we can't talk about the subject of the polls anymore?

    --
    If you think I voted for Trump because of this post, you're wrong. I voted for Dr. Jill Stein of the Green Party. Again.
    1. Re:Question about the polls. by dkf · · Score: 1

      What is the reason we can't talk about the subject of the polls anymore?

      It doesn't matter; I won't vote in them when I can't discuss them.

      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
  20. Re:Troll much, slashdot? by satuon · · Score: 3, Insightful

    Java is slow because it is Garbage-Collected, not because it runs in a Virtual Machine.

    Memory usage is more important than the virtual machine for performance for anything more complex than calculating Fibonacci numbers, as it affects hard drive swapping and cache misses. That's what is making Java programs **feel** slow. The hard disk is the bottleneck, not the CPU.

  21. Re:Troll much, slashdot? by TemporalBeing · · Score: 1, Informative

    You do know that Java is compiled to native, don't you?

    Yes, Java can be compiled. It can also be run interpretted. Either way, it runs in a Virtual Machine, which in and of itself adds another layer in the stack and slows the software down, however small the difference may be it will be there.

    The only reason Java is slower than C, is because C can have unchecked arrays, or low level access to CPU registers or vector SIMD.

    Given the same code written in both C and Java, and including C range bounds checking (to make it as safe as Java), the speed will be the same. Or, quite possibly Java would be quicker once the JVM starts stripping away the checks once it realises there is no possibilities of bounds been breached.

    And yet in embedded environments the advise when using Java is do to write in software in such a way that the GC is never invoked because it causes major performance penalties at unexpected times.

    --
    Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
  22. Re:Troll much, slashdot? by Anonymous Coward · · Score: 1, Informative

    I used to work for a company that provided high frequency trading software. We once competed with 4 other companies for a sale to a rather large client, one of them were written in C one was written in C++, the other was unknown. We beat them by 10% (performance was the time a price update was received on the the LAN to the time an order went back out on the wire, as measured from network sniffing device, all tested by them on their hardware). Our software would run 1k-2 warmup/test updates through the system after startup before it went into live trading mode, by then all the critical paths had been fully optimized and compiled to CPU specific instructions. We even tried commercial Java to binary compilers and the standard jvm beat them (after the warmup period). When you compile C/C++ program you usually dont do it for a specific cpu to take advantage of specific instructions, when the JVM JIT kicks in on fully optimized code it is optimized for the specific chip in the computer (again, this is after a warmup period, but in these cases or the case of a web server those are fine). Memory allocation in java is faster than C/C++ and has a higher natural rate of locality of reference, the trade off of course is the gc phase, but using parallel mark and sweep algo's the lock time is relatively small, our customers (your banks) were willing to risk 1 in 1000 transactions being delayed by gc in order to get a 10% boost on over their competitors on the other 999 transactions.

    In the end we were acquired by a multinational corp, I gave them the finger, now I work for a start-up.

  23. Re:Troll much, slashdot? by elfprince13 · · Score: 2

    because it is an run time interpreted language

    Wrong. This hasn't been true for more than 15 years 1996. It's a JIT-compiled language, which means it has a slow startup time, but once the VM is warm, it can actually outperform C on numerical code. Really.

  24. Re:Troll much, slashdot? by medv4380 · · Score: 1

    He runs all java apps with the -Xint
    Interpreter only mode is awesome.

  25. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    Once Java byte code is loaded, it's compiled into something native by the JIT compiler. The start-up is slower than C++, but many of the low level functions are just as fast once they've started.

    Besides, there are some things that C/C++ compilers can't optimize on that Java compilers can. See http://en.wikipedia.org/wiki/Comparison_of_Java_and_C%2B%2B#Performance

  26. U just read about programming instead of doing it? by Jerry+Atrick · · Score: 1

    A run time interpreted language that in real life JVM implementations is a run time profiled, optimised and compiled language. That can create better optimised code than any compile time optimiser could because it's optimising against the actual workload instead of guessing what it might be and compromising against many possibilities.

    Java is a shitty language with many nasty aspects, you managed to pick the one thing it can get very right. Not much of a programmer then.

  27. Speed up by Anonymous Coward · · Score: 0

    Can you use GCJ to compile to native? I never tried it, but I have this impression you can write in Java and compile to native with GCJ instead of bytecode, and you should be on par with C++.

  28. Poll's knackered by Anonymous Coward · · Score: 0

    Why is there a new poll on the front page but it's already archived so we can't post comments?!

    And what the hell is "A tough tighter" ?!

  29. Re:Troll much, slashdot? by serviscope_minor · · Score: 5, Informative

    The only reason Java is slower than C, is because C can have unchecked arrays, or low level access to CPU registers or vector SIMD.

    That and C and C++ have faster allocation and deallocation of temporaries. And they have no runtime specification of what's going on, so the optimizer is allowed to do more.

    Specifically, C/C++ (one of the few times where such a phrase is meaningful) require the programmer to specify stack allocation or heap allocation. Stack allocated objects are completely free. At the point of function call and return, it simply uses a different size for the increment/decrement.

    Java has an excellent heap allocator (very fast) and can do good escape analysis, but very fast is aloways slower than free and escape analysis is never as good as by-hand specification.

    In terms of the optimizer, java specifies all sorts of things about how stack traces from exceptions must be accessed and so on. C/C++ don't specify anything about those. As a result, the optimizer is free to remove more stuff than in C/C++ than Java. If you compile with -O3, it's not uncommon to find the debugger thinks you're in a completely different place than seems to make sense.

    Or, quite possibly Java would be quicker once the JVM starts stripping away the checks

    The thing is, java trades some safety and tighter specification for some performance loss. C and C++ allow the programmer to specify more. While the JVM is very good at removing a lot of stuff, it's always fighting an uphill battle to remove stuff that simply isn't there in C and C++.

    --
    SJW n. One who posts facts.
  30. Re:Troll much, slashdot? by elfprince13 · · Score: 2

    Many JVM implementations can make use of SIMD at run time because they know what they're running on. Additionally, in many algorithms, the pointer indirection cost in C is higher than the bounds checking cost in Java (because pointers make life hard on optimizing compilers, and HotSpot doesn't have that disadvantage). Cache coherency also plays a big role. See the link in my reply to parent comment.

  31. Latency != Determinism != Speed by Anonymous Coward · · Score: 2, Insightful

    Java runs in a virtual machine, and is compiled "just in time".

    For "real time" applications, that need guarenteed latency, this is a no no.

    Java's garbage collection, running is also a no no.

    Real time applications need hard deadlines, that are deterministic. A function must always return X mSec, regardless of any other things like GC, etc.

    Just imagine if say a pacemaker ran Java.

    "I detected an unusual event, but I have to run GC first, then process the event..oh, what the patient is dead?"

    Why don't we have for ultimate speed, a java interpreter written in java, running on a java interpreter written in java running on... ad nauseaum?

    I don't want a 15 min boot time for my embedded system. there is a reason most Android tablets have huuuge lag at unexpected times. Give me access to the bare metal any day. I'll figure out memory management myself, thank you very much!

    Then again, I come from the embedded days, when memory was and sometimes still is, measued in Kb, not Gb.

    Java is great for student programmers and others of limited skill that need to produce *something* ,at limited cost. They can't really harm the underlying system, and don't need to lean any hard concepts like memory management and real-time deadlines.

    1. Re:Latency != Determinism != Speed by bws111 · · Score: 2

      Educate yourself.

  32. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    Not runtime interpreted, but it is in a virtual machine.

    Personally I have never figured out how people find Java usable. Back when I was programming Java I always found myself in situations where there were a gazillion ways to solve a problem and the documentation never hinted on the performance issues one could run into with different approaches.

    Also, garbage collecting must be horrible in low latency applications. Instead of getting extra delays at a time that you have determined, usually directly after you are done with your task, you get the garbage collection work at random times that may or may not occur at appropriate times.
    If you really want maximum performance you should manually free resources you don't need. If you need better control of when the freeing process happens you could pool the freed resources and flush them out at a time that you know is appropriate.

  33. Easy-peasy! by pla · · Score: 1

    Step 1) Don't.
    Step 2) See step 1.

    C developers often get accused of trying to use their particular hammer to drive in every screw they see. This very much counts as the other side of that equation.

  34. Re:Troll much, slashdot? by UnknownSoldier · · Score: 1, Insightful

    > I think currently, the difference in performance between Java and C++ is so close that...

    Additionally the problem is this blowhard is talking out of their ass (SWAG / opinion) instead of showing us cold, hard, facts.

    Open Source + Open Data = let the results speak for themselves instead of some opinion that no one gives a fuck about.

    Mod Article: -1 Troll

  35. Re:Troll much, slashdot? by Trepidity · · Score: 1

    When it's compiled, e.g. by gcj, Java doesn't run in a virtual machine. It's compiled to native code.

    The reason it's not done much is that this is actually slower for many tasks than the optimizing JIT is.

  36. Java vs. C/C++ by Anonymous Coward · · Score: 3, Informative

    For simple applications that don't deal with a lot of dynamic memory, Java is almost as fast as C/C++. Unfortunately, trading systems are not such - I know because I worked in that domain for some time, in the 1980's and again in the 2000's. Java's biggest issue is garbage collection - it is decidedly non-deterministic. IE, it can have SERIOUS impacts upon performance, and at times that cannot be pre-determined. In my experience (30+ years), if you need consistency and speed, then you do not select Java for your environment - and I do a LOT of Java development. I just don't use it when I need the software to have a small footprint, be fast, and stay out of the way of other system processes.

    1. Re:Java vs. C/C++ by K.+S.+Kyosuke · · Score: 2

      In my experience (30+ years), if you need consistency and speed, then you do not select Java for your environment

      You have 30+ years of Java experience? Wow. BTW, if you do have a lot of Java development under your belt, how does Zing compare to other solutions in your application domain? Still inconsistent and slow? (I mean, the GC implementations started converging to what can be described as "good performance" only in the last few years, so unless you focus solely on the last few years, of course your experience is going to be horrible on the average.)

      --
      Ezekiel 23:20
    2. Re:Java vs. C/C++ by Anonymous Coward · · Score: 0

      You have 30+ years of Java experience?

      Well, you would certainly not select Java for your environment before the language was even introduced.

    3. Re:Java vs. C/C++ by Anonymous Coward · · Score: 0

      Java didn't exist in the 1980s. AC is a liar, lol.

    4. Re:Java vs. C/C++ by Anonymous Coward · · Score: 0

      You are a snarky idiot. He could very well have used Lisp or Smalltalk (which all have the same deficiencies as Java - the GC) and match that experience with the Java experience.

    5. Re:Java vs. C/C++ by K.+S.+Kyosuke · · Score: 1

      He could very well have used Lisp or Smalltalk (which all have the same deficiencies as Java - the GC)

      Lisp has DYNAMIC-EXTENT, so it's hardly directly comparable to Smalltalk and Java, and GC is not a deficiency, it's an asset. The only way to get actually predictable timings in any language is not to do any heap allocation at all, and to turn off caches and virtual memory. On PC, one more thing you need to do is to prevent the System Management Mode from stealing your wall time. If you have to do heap allocation, it doesn't matter whether you're using GC or malloc(), you're screwed anyway.

      --
      Ezekiel 23:20
  37. Lots of Different Languages are Used by keltor · · Score: 1

    I suppose as long as the programmers are ACTUALLY equally skilled it would be fine, but from what I've actually experienced in the real programming world, the C++ programmers are generally all fairly experienced skilled programmers who write effective efficient code. With Java programmers, I have seen quite the opposite, sure there are those experienced skilled programmers who could compete, but a LOT of Java programmers even ones with equal 10-12 years of experience, suck monkey balls at actually writing efficient code. Instead they write code that's JUUUST good enough. That said I know a number of people in the HFT market and the programming languages are ALL over the place, sure some of them are in Java and some are in C++, but there's not any one dominating language: there's plenty of Python, Scala, Perl, Groovy, and probably every language you can image. I believe Perl is actually still the biggest language because a lot of the financial analysts can actually write it directly and so do stuff that the front end systems don't normally allow.

  38. Re:Troll much, slashdot? by rockmuelle · · Score: 1

    More important than the actual runtime environment is that fact that in any networked application that processes lots of data, _latency_ is the bottleneck, not the actual performance of a well implemented* algorithm. The latency between servers, between RAM and the CPU, and even between L3 and L1 (hell, even from L1 to the registers) will have a larger impact on the overall performance than the actual language used. Round trips to and from memory (either local or remote) are what kills performance for most code**. Good programmers know this and optimize for these latencies when implementing an algorithm, regardless of the language.

    Even in a low latency environment, well implemented algorithms in scripting languages can outperform poorly written C/C++ and Java. In the financial world, those guys are laughing all the way to the bank (true story).

    -Chris

    *assume for the sake of discussion that both the Java and C++ implementations are done by good programmers who know how to optimize in their target language.
    **remember, round trips occur every time you call a function/method and the stack has to be saved... it's not just data access that triggers this.

  39. C# might be the missing link by Anonymous Coward · · Score: 0

    I've noticed that financial software jobs often look for C#, I'm guessing it's because Visual Studio and its debugger gives the engineering leads (who typically have domain expertise in financial systems) a warm fuzzy feeling.

    Then maybe some of them decided to move to commodity x86_64 Linux servers, so they needed a replacement for C#. Java is the obvious bet, along with Eclipse I guess (but they'd better have LOTS of RAM or they'll be crying over "out of heap memory" errors).

  40. Re: Troll much, slashdot? by immakiku · · Score: 2

    FYI the author of that quote is the chief engineer of a C system on which enterprise, low latency trading systems are built. So when he says it, I would tend to give that more than the passing thought.

    Those items quoted have indeed been recently shown to bring performance close to similarly developed C++ systems. Though you are right that the layer of indirection will always mean overhead, if you are working low level enough and real time is not your goal, that indirection is what allows your code to be run time optimized and compensate for the cost of the overhead.

  41. Re:Troll much, slashdot? by smittyoneeach · · Score: 1

    And really, until code developed in either reaches the stage of being re-done as an Emacs major mode, how seriously can it be taken?

    --
    Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
  42. Re:Troll much, slashdot? by Anonymous Coward · · Score: 5, Informative

    Ram is cheap, and you have control over the max heap size on your java call, so I don't know why you think disk swapping is a problem. Not only that, but garbage collection can actually speed you up in some cases: if you can defer memory management from a time when it would slow you down to a time when you're sitting on free time anyway (waiting for io, etc), you are actually sometimes better off.

  43. Blah blah blah by sunking2 · · Score: 2

    Low latency is not measured in the millisecond, but in the microsecond. I'm so tired of hearing about how special the HFT think they are.

    1. Re:Blah blah blah by EricTheGreen · · Score: 2

      Exactly. Y'all come back to me when you're programming a cell phone switch and then you can talk about low latency...

    2. Re:Blah blah blah by tlambert · · Score: 3, Informative

      This struck me as well. In the original article, they put a bound of 100 milliseconds as counting as "low latency" in their book, but Wikipedia's article on algorithmic stock trading puts it in the microseconds instead:

      "Low-latency traders depend on ultra-low latency networks. They profit by providing information, such as competing bids and offers, to their algorithms microseconds faster than their competitors."

      https://en.wikipedia.org/wiki/Algorithmic_trading#Low-latency_trading

      100 milliseconds is about 10,000 times too slow, even if we are talking in the neighborhood of "tens of microseconds faster", rather than just "microseconds faster".

      Here's an article from 2011 where they justified spending $300M ($0.3B) on a new transatlantic cable to eke out an extra 6 milliseconds: http://www.telegraph.co.uk/technology/news/8753784/The-300m-cable-that-will-save-traders-milliseconds.html That's just 6% of the 100 milliseconds that these Java guys are willing to waste running Java instead of C code.

  44. What's the news here? by Anonymous Coward · · Score: 1

    Really I'm not trying to troll here

    12 years ago I started in the backing sector in London, and over the last 5-7 years I have been working/involved in the Algo trading arena

    I have always used Java to write the Algos

    1. Re:What's the news here? by Anonymous Coward · · Score: 0

      Java and C# and every script language is for dumb dumbos.

  45. Re:Troll much, slashdot? by Tchule · · Score: 1

    Wrong exemple, Facebook has since replaced their C/C++ compiler (HipHop) with the use of a virtual machine and they have gained in performance in the process. http://www.javaworld.com/javaworld/jw-07-2013/130726-facebook-invents-php-virtual-machine.html

  46. Collect the Garbage Collection by Anonymous Coward · · Score: 0

    If Java ever ran Garbage Collection properly, it would collect the whole spec and lanaguage, destorying itself, or sending it neatly packaged up to the curb.

    I am tired of input lag.
    I am tired of 15 million different versions of the interpreter, all with conflicting libraries, specs , etc.
    I am tired of having to install hundreds of Mb of crapware for some crapplet.
    I am tired of unpredictable runtimes, poor debugging messages, poor quality manuals, poor quality docs, etc.

  47. Re:Troll much, slashdot? by serviscope_minor · · Score: 3, Insightful

    Really.

    Meh.

    http://benchmarksgame.alioth.debian.org/u64/java.php

    Or not. Benchmarks are a game and everyone likes to play, except the users of brainfuck for whom creating a program which completes is essentially winning.

    The thing is people have been trumpeting "blah is as fast as C/C++/Fortran" since nearly the inception of C and C++ and probably shortly after the inception of FORTRAN.

    I think there is a kernel of truth in that the reason C, C++ and FORTRAN/Fortran are always the targets is because they are almost always either the fastest or with a few percent of the fastest.

    When people start comparing execution speeds of Haskell, Python, C#, C++, $NEWLANGUAGE etc consistently against Java then I'll believe that Java is indeed king of the hill.

    --
    SJW n. One who posts facts.
  48. Re:Troll much, slashdot? by h4rr4r · · Score: 2

    These are HFT folks, they have essentially unlimited money. Take a TB of RAM, use half for a tmpfs and you no longer worry about IO. A safer route and more expensive would be to just use PCIe SSDs.

    Unlimited money solves a lot of problems.

  49. Who the fuck modded YOU up? by Anonymous Coward · · Score: 0

    Good Lord what a load of uninformed CRAP

  50. Uh , since around 1998? by WOOFYGOOFY · · Score: 4, Insightful

    Uh since around 1.3 the JIT optimization for java has led to blindly fast code containing optimizations which are not even available to C++ . Dynamic compiling allows for branch prediction to be more accurately, unlike malloc, the GC knows where to look for free memory and returns it from the last bit of memory you just requested, if you know where pointers are pointing at compile time, you can put them in registers. C++ and other statically compile languages don't have this information, so it stores them in cache, but the JIT can acquire this information and store it in a register. It's the difference between a register to register test and reading from disk.

    There are tons of other stuff like this. I don't have it committed to memory, and compiler technology is not my thing but if you look around you'll see that actually GC and JIT are theoretical advantages in terms of speed and those advantages are being realized. It can even figure out what chip it's being run on at runtime and optimize the code for that chip.

    The Java is Slow Meme is left over from 1995 before there was even HotSpot.

    Not bashing any other language here. C# could also avail itself of these advantages.

    1. Re:Uh , since around 1998? by serviscope_minor · · Score: 1

      unlike malloc, the GC knows where to look for free memory and returns it from the last bit of memory you just requested,

      Ah, the old memory allocation canard. Java can allocate from the heap faster than C++. However C++ can allocate from the stack for free which java cannot do nearly as readily.

      --
      SJW n. One who posts facts.
    2. Re:Uh , since around 1998? by StormReaver · · Score: 2

      Java continued to carry the stigma of being slow, and rightfully so, because it was horrendously slow for desktop use until Project Mustang (Java 6). Java 6 marked a point where Java not only no longer sucked for desktop application use, but actually became quite good at it.

      Printing went from completely, unusably slow to blazingly fast.
      GUI components went from being painfully slow and difficult to program to some of the fastest and most flexible GUI components I've used on any platform.

      Java was considered painfully slow for so many years because it WAS painfully slow for so many years (at least in the way that a great many of us wanted to use it). It's growth from unusable to highly desirable has still been relatively recent (five or six years).

    3. Re:Uh , since around 1998? by phantomfive · · Score: 3, Interesting

      All that is nice theory, but in practice C still runs faster, for various reasons. The problem you have is that you're only looking at facts that support your position. That is the problem with the world.

      Consider that every single array access in Java is checked, for starters.

      --
      "First they came for the slanderers and i said nothing."
    4. Re:Uh , since around 1998? by WOOFYGOOFY · · Score: 1

      Java continued to carry the stigma of being slow, and rightfully so, because it was horrendously slow for desktop use until Project Mustang (Java 6). Java 6 marked a point where Java not only no longer sucked for desktop application use, but actually became quite good at it.

      If this were true, I would have known about it. Consider Intellij IDE -a java desktop client - has been superfast since at least 2001 . You can't say an IDE isn't a *real* desktop client since most desktop clients do a LOT less than IDEs have to.

      It's just not true what you said. It's just a matter of facts being one way or the other .

    5. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      I think it's more about Java's bloat and sloth is less of an issue these days. Wickedly fast processors and gobs of memory mean that other factors dominate HFT.

      It's easier to write stuff in Java rather than C... and it's now become less of a drain (more thanks to Moore's law than any improvements in Java).

    6. Re:Uh , since around 1998? by Jerry+Atrick · · Score: 1

      Significantly more important: C++ can release stack frame allocations for free and causes zero memory fragmentation.

    7. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      Consider that every single array access in Java is checked, for starters.

      You say that like it's a bad thing.

    8. Re:Uh , since around 1998? by gbjbaanb · · Score: 1

      to be fair to Java, it can allocate memory in much the same way as the stack does - the GC simply grabs another clock from the heap and returns it.

      However, that's where the similarity ends. Java then has to maintain an indirection pointer to the memory, as java programs use this technique to get fast memory access, they tend to create a lot of objects, meaning lots of little allocations which end up scattered through the heap meaning lots of CPU cache misses requiring more memory fetches (hence the use of StringBuilder - see GC allocs aren't as good as everyone says they are or this class wouldn't exist). It also ends up with gaps in the memory heap which it has to resolve every so often by pausing the app and compacting the heap - ie copying huge chunks of memory about. Then it can continue allocating freely.

      So the problem is that you have 1 case where it is nice and fast, almost as fast as using the stack in C/C++, but the disadvantages are massive. That's 1 reason why Java programs are slow.

    9. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      It still is extremely slow on the desktop.
      I still need to work with configuration applications written in Java which not only take 20 seconds to start, but then the UI takes about a second to react on a mouse click.

      I've actually was forced to program in Java and it works quite well if you are a very good programmer. For a mediocre programmer Java is about the worst language you can put in front of them. Sadly very good programmers don't want to program in Java, and I still don't.

    10. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      How do you know Intellij IDE people didn't have to make a bunch of compromises away from the way they *really* wanted to code it....

      By seeing the finished product, you *don't* see the compromises they took, only the possibly sub-par solution they realized before shipping.

      Perhaps it's only fast because of some ugly code hacks to get around the JVM. All you know by using the "fast" finished product, is that they were perfectionists and did whatever it took to make the app fast.

    11. Re:Uh , since around 1998? by solidraven · · Score: 1

      Ah yes, the good old JIT argument. Then again, I did see Java 6 lose to Perl at several tasks in both speed and memory use. The myth that JIT is able to optimize better than a conventional compiler is pure bullshit. If you're doing low latency data handling it generally means you're working on an embedded system (routers, switches, control systems). On these systems resources are well defined, the memory layout is set ahead of time and the architecture was designed specifically to move data around quickly, and on time. On systems like these C and to some degree C++ outshine most conventional programming languages. Though nothing quite beats Ada at it...

      But back to the compiler issue, JIT compilers have a major drawback. They have a very short time to run in if you wish to stick to the "just in time" methodology. A compiler like MSVC or GCC can take several minutes (or even hours) to optimize a program. In terms of branch prediction Intel and IBM compilers are a clear example of how to do it right, they will either attempt to make a calculated guess ahead of time of the most likely scenario or they will listen to the programmer (some compilers have special commands for this) for the most likely result. So that advantage is moot. The memory allocation thing is also bogus, in the end your operating system is still in charge of memory management. Managing the memory and CPU time is the main task of the operating system. Additionally your C program is quite capable of allocating the memory for some task and keeping it reserved until it's needed again. So there you lose another claimed advantage. Memory address translation is mainly a task of the CPU, your JIT compiler can't fill in absolute memory addresses either and shouldn't even be aware of it in the first place. The OS can move your application to another address at will if necessary, only the OS and the CPU need to know about this. And the moment you can replace a pointer by a direct address reference it's possible for your C/C++ optimizer to do it as well. Many of the advantages you claim for JIT are purely software based, but negated by hardware in the end. But this is where the conventional compiler is able to get the advantage. It has the time to optimize and analyze solutions to fit a particular CPU architecture. Your JIT compiler doesn't have the time to do this, optimizing a large program is a very complicated task from a mathematical point of view (check graphy theory to know why).

      But Java for low latency is a joke, because it's unpredictable. If I write a snippet of C code I'm pretty sure what's going to come out at the assembly end. This isn't the case with Java. Which brings me to a very interesting bombshell to end this one on: usage of interrupts and timers. In C/C++ you can use inline assembly to call up hardware features of your CPU. And lets face it, nothing beats an interrupt at low latency. Combined with timers for periodic checking you got a killer combination when using C/C++ + assembly. And JNI just isn't fast enough to be able to beat that advantage. But in hindsight both of them suck at low latency and pure high performance. Low latency is the domain of Ada, assembly and hardware. If you claim otherwise you're not working on true low latency problems.

    12. Re:Uh , since around 1998? by ebno-10db · · Score: 1

      actually GC and JIT are theoretical advantages in terms of speed

      That's nice, but where are the benchmarks?

    13. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      > Consider that every single array access in Java is checked, for starters.
      >
      Actually, this is only mostly true. If, however, the JIT can determine that your accesses won't walk beyond the scope of the array then it will skip them. (E.g. in the simple "for (i=0; i a.length; i++) j += a[i];" case.) Also the "for (int i : a) j += i;" form doesn't need to do bounds checking.

      So, the statement was mostly correct, I just wanted to nitpick.

    14. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      That is no longer true in Java7, most of the access for arrays are no longer checked as the JIT can make sure that the loop through the array is secure.

    15. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      Don't forget there has been Profile-Guided Optimization for C++ and Fortran compilers for ages (gcc can do it too). Then, Fortran compilers can do loop-reordering to access your Cache properly. A Mr Kuck (now of Intel) did some massively interesting work on that decades ago. Fortran still kicks everbody in the balls, in the science/engineering world, despite being one of the oldest languages of all. Look up Mr Kuck as in "Seymour Cray".

      JNI is super-clunky as you need to pin down Java objects before you can use them in JNI. Which is VERY expensive compared to the JNI call itself.

      Dipl.-Ing.(BA) Frank Gerlach
      Gäufelden
      Germany

    16. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      In languages like Fortran, C, C++ and Sappeur, I can allocate 1 million objects in one consecutive array of octets. Then I can loop over these objects as fast as the CPU cache can be filled. There won't be a single octet of cache wasted or loaded in vain.

      With Java, I need to allocate an array holding 1 million 8-byte references and then I need to call the new operator 1 million times. That means I will waste something like 1 million * 16 bytes and the reference array. To top up the waste, I need to waste cache space for the references and then load some randomly allocated, wasteful objects into my little cache. More or less the definition of Regression In Computer Science.

      Mr Kuck and Mr Cray were way ahead of Mr Gosling when they worked on the CDC 6600 and the Cray 1 machines. And the magnificient Fortran compilers doing marvellous optimizations that are in many ways unamatched today.

      Dipl.-Ing.(BA) Frank Gerlach
      Gäufelden
      Germany

    17. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      Are you actually implying that low-latency programs would dare to use malloc()? That function suits rapid prototyping better than production code...

      mlockall(MCL_CURRENT | MCL_FUTURE);
      if (mmap(......) == MAP_FAILED) punt();
      #ifndef SHM_LOCK
      #error foo /* dangli

    18. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      Consider that every single array access in Java is checked, for starters.

      No, it isn't.

    19. Re:Uh , since around 1998? by Anonymous Coward · · Score: 0

      Every array access in Java is checked, except for the ones that the compiler/runtime can determine don't need to be. For most code, the accesses in your hotspots will fall into the exception.

      for (int i = 0; i array.length; i++) {code involving array[i]}

      As long as the block does not do certain types of things, it can deduce that i is always a valid index for the array and so skip the checks.

      The real problem is that most people arguing Java is slow don't know about many of the optimisations Java can do. Most people arguing that it isn't don't know the limitations on those optimisations, or how you tell if you've done something that turned one of them off.

    20. Re:Uh , since around 1998? by mattpalmer1086 · · Score: 1

      I think you may be suffering from the same confirmation bias problem. In some cases the Java optimizer can determine that out of bounds access is not possible and it optimizes the additional bounds checks out. For example, a loop that goes from zero to array length - 1 can remove the array bounds checks. So every single array access in Java is not necessarily bounds checked.

      But most of them probably are, and in practice C mostly runs faster than Java. But not always...

  51. The programmer, not the langauge by LostMyBeaver · · Score: 3, Insightful

    Leaving aside my political beliefs that high speed trading needs to be banned, let me say this.

    Switching to Java should yield similar results to C++. What matters is whether the programmer understands the memory architecture of the run-time environment well enough to not have issues. Generally, you'll find that even the best programmers in either language will overlook things like garbage collectors and memory fragmentation issues. It's a time-to-market thing. When working with large dynamic data sets, it doesn't matter if you're using Java or C++, the developer needs to be able to adapt their code to perform well on the system.

    Code written without considering the processing time of memory management will probably work much better in C++ than Java. That said for huge data sets, Java could perform better since the memory itself is location independent and it is highly probable that you're gain a great deal of performance from being able to defragment memory. Consider however that the garbage collector and the defragmenter will have unpredictable times which can cause multi-millisecond hiccoughs during processing.

    I recommend if you take this route, you hire a compiler geek to work on staff optimizing the memory operations.

    1. Re:The programmer, not the langauge by Anonymous Coward · · Score: 0

      From my own little benchmarking with Sappeur and Java, I can testify that the naive use of the new operator is much more wasteful in C and C++ style languages than in Java.

      Good C++ programmers know about that and ensure new and delete are called judiciously and will amortize over massive loops. For example, declare a string buffer outside a loop and reuse it n (e.g. 100000) times, or Java will blow C++ out of the water, performance-wise. With RAII, this is not really an issue, as long as you know what new and delete (or malloc/free) actually do INSIDE the C and C++ standard libraries.

      All that is only true if the Java program is allowed to consume about 200% more memory than the C, C++ or Sappeur equivalent. If you limit the Java RAM to roughly the same as the C++ equivalent, the GC will run all the time and destroy Java performance.

      Dipl.-Ing.(BA) Frank Gerlach
      Gäufelden
      Germany

  52. C++ can operate at the very limits by EmperorOfCanada · · Score: 1

    First I am not saying that Java has no place.

    To me this is not a case of Java being fast enough as good enough. Keep in mind these are people who are building their own microwave towers from one exchange to another to shave microseconds. But also keep in mind that this is is also the era of big data. So you now have a situation where you have to process insanely large amounts of data in near as is possible to real time in order to make trades "Now!"

    So if I write a test program in Java that connects to a database and adds up a few columns and then compare it to the same program written in C++ I doubt that there will be a big difference. And if you trading algorithm is small then Java is probably best as your time to market will be shorter.

    But if you have 5 Gigs of data coming in every 10 minutes that needs to be sifted, sorted, and processed, then again time to market might be better with Java and the processing time might not be that different. But now if you start to get cool and are using crazy Algorithms to squeeze your data dry then you might be pushing up against the limits of the hardware itself. Now you must be in C++ land or you needn't bother. The processing time difference between C++ and Java will be great enough that the market will move faster than your computers can.

    Now this last case might seem like the weird case so a person could say well Java covers 95% of our needs. The problem is that if you have no C++ development at all then starting C++ just for this extreme case will not be easy to support. Thus a nice mix of Java and C++ is probably better than just one or the other.

    A great example of this sort of experience for us programmers would be Eclipse and Sublime Text 2. Eclipse is mostly Java and for years drove me mad as it would start grinding away at whatever. Or I would start typing code and Eclipse would sit for 10 seconds before a bunch of my typing showed up. It took forever to start and so on. Sublime text starts in a flash, runs at warp speed, and has extra cpu cycles left over for things like the mini-side-view. Again this is not a perfect comparison as Eclipse is much more of an IDE and does 1 billion other things but I find they both are reflective of the Java and C++ philosophies. Java programmers love creating an object for damn near every thought that pops into their heads. They love multiple levels of abstraction. Whereas many C++ programmers are 70% C programmer and 30% C++ programmer which is a near endless war within the C++ world. So C++ programmers tend to head for the simplest possible solution, not the most flexible solution, not even the most maintainable solution.

    So in the trading world if I were laying out the staff and the architecture for a large zillion user trading system that will be created and maintained by a large team(s) of programmers then I would stick with Java. If I had a small crack team who are to build a system for implementing an ML system that looks at traffic patterns to predict spot corn prices in the next 5 minutes then C++ all the way baby!

    1. Re:C++ can operate at the very limits by bws111 · · Score: 1

      You lost all credibility as soon as you used Eclipse as an example. I use Eclipse almost every day. It does exhibit some of the behaviors you say. BUT, and this is a very large BUT, Eclipse is a desktop application, running on whatever you happen to be running, with absolutely NO tuning of the JVM. Applications like HFT are NOT running on some random desktop, they are running in servers with sufficient resources and, more importantly, proper tuning of the JVM to meet their needs.

      There is no reason Java can not run just as fast and predictably as C/C++, given people who know what they are doing.

    2. Re:C++ can operate at the very limits by Mr+Thinly+Sliced · · Score: 2

      There is no reason Java can not run just as fast and predictably as C/C++, given people who know what they are doing.

      Yes, yes there is. Well, more than one actually. Here we go again:

      (1) Unbounded stop the world of the JVM causing thread stalls (GC being the canonical example)
      (2) Other stop the world's in the JVM due to code profiling causing a newly compiled version to be swapped in (maybe they've switched to atomics here, I'm not sure)
      (3) Java's internal profiling and housekeeping absorbs CPU cycles
      (4) Everything is allocated on the heap. If you have an array of objects - it's an array of pointers to things in the heap. There is no packed array of structs

      These are the ones I've run up against when attempting to reduce scheduling latency in Java.

      You can reduce the impact of (1), (2) and (3) using a realtime Java VM - but then you're not really writing Java - you can't use standard containers or standard libraries as they allocate memory all over the place. Also, the ahead of time compilation means you've lost the benefit of that lovely JIT re-profiling and optimisation.

      (4) Can be mitigated a little by using NIO buffers with long offsets - but it's a mess and adds unnecessary extra computations to something that should just be pointer + offset.

      To get down to it - with the standard Java VM I get scheduling latencies occasionally larger than 20ms - with C++ my thread scheduling latencies are measure in nanoseconds (i.e. less than a microsecond).

      This is on a real time kernel with all appropriate thread priorities and such.

    3. Re:C++ can operate at the very limits by ArsonSmith · · Score: 1

      This is why the big data platforms like Hadoop, Cassandra, Hbase and all are written in C and/or C++.

      --
      Paying taxes to buy civilization is like paying a hooker to buy love.
    4. Re:C++ can operate at the very limits by Anonymous Coward · · Score: 0

      Have a look at Sappeur. It aims to marry the advantages of Java with those of C++.

    5. Re:C++ can operate at the very limits by Anonymous Coward · · Score: 0

      Yet another Java hater who's info is AT LEAST 3 years out of date. Come back when you've actually learned something about contemporary JVM implementations.

    6. Re:C++ can operate at the very limits by Mr+Thinly+Sliced · · Score: 1

      Pfft. I prototype in Java 7, then implement the real thing in C++.

      I notice you haven't actually refuted any of my points, by the way. Go away, troll.

    7. Re:C++ can operate at the very limits by EmperorOfCanada · · Score: 1

      No Java can't run as fast as C++ when C++ is pushing out to the limits. If you have 64Gigs of physical memory and you tightly fill it with 60Gs of carefully designed structs that you are sorting and noodling with in as close to real time as you can get Java won't even be invited to the party. Now you realize that you need to push that data onto a hard drive as fast as humanly possible so you don't use a file system you just directly access the harddrive and write the raw data. Then you realize that you need to use the newest CUDA abilities of the video card which Java technically can do but you need to move those tightly packed structs into the memory as fast as the hardware can handle it. Well seeing that the structs are byte for byte identical in RAM as they will be in the Video Card's memory then there will be no translation at all. You will just squirt them straight into the memory for the GPU.

      As I said at this extreme edge Java won't be invited at all. But this is not to say that Java is crap; it is just that it has limitations. A simple example is that when people are making the leading edge games C++ is too clunky and they tend to use mostly C. Java again is just not invited to that party. Was impressed that Mindcraft was done in Java until I saw it done in Python and then realized that it isn't that demanding a game.

  53. Re:Troll much, slashdot? by wonkey_monkey · · Score: 3, Funny

    These are HFT folks, they have essentially unlimited money.

    Unlimited money solves a lot of problems.

    But not, apparently, the problem of an ongoing obsession with making even more money.

    --
    systemd is Roko's Basilisk.
  54. Sorry but... by Anonymous Coward · · Score: 0

    Networking is far from low latency, it will always be the bottleneck, even if you use QBASIC.

  55. Re:Troll much, slashdot? by teknopurge · · Score: 1

    mod parent troll, or just -1 ignorant.

  56. Warm up is a big deal by johndoe42 · · Score: 3, Interesting

    I'm not a Java user, so I've never directly tuned for things like GC, nor do I interact with it directly. Warm up is a different story.

    I interact with quite a few exchanges (over all kinds of protocols). Most are, unsurprisingly, written in Java. Almost all of them perform terribly at the beginning of the week. The issue is a standard one: the JVM hasn't JITted important code paths, and it won't until several thousand requests come in. For a standard throughput-oriented program, this doesn't matter -- the total time wasted running interpreted code is small. For a low-latency network service, it's a different story entirely: all of this wasted time happens exactly when it matters.

    The standard fix seems to be to write apps to exercise their own critical paths at startup. This is *hard* when dealing with front-end code on the edge of the system you control. Even when it's easy, it's still something you have to do in Java that is entirely irrelevant in compiled languages.

    If JVMs some day allow you to export a profile of what code is hot and re-import it at startup, this problem may be solved. Until then, low-latency programmers should weigh the faster development time of Java with the time spent trying to solve annoying problems like warm-up.

    1. Re:Warm up is a big deal by Mr+Thinly+Sliced · · Score: 1

      The standard fix seems to be to write apps to exercise their own critical paths at startup. This is *hard* when dealing with front-end code on the edge of the system you control. Even when it's easy, it's still something you have to do in Java that is entirely irrelevant in compiled languages.

      These people should be using a real time Java VM and an ahead of time compiler for those parts.

      It means you can skip the warm up. The only problem with it is you can't hire regular Java guys - real time Java is a little bit special, and you can't use regular Java collections and other things in the ways you'd expect.

    2. Re:Warm up is a big deal by johndoe42 · · Score: 1

      These people should be using a real time Java VM and an ahead of time compiler for those parts.

      It means you can skip the warm up. The only problem with it is you can't hire regular Java guys - real time Java is a little bit special, and you can't use regular Java collections and other things in the ways you'd expect.

      That's not the only problem. Doing this switches you from using a well-standardized, well-supported language to a nonstandard subset. This removes a lot of the advantages of Java.

      One of the most technically competent exchanges I work with is trying out Azul, which is (AFAIK) the top-of-the-line low-latency JVM. I was a bit surprised to learn that their software didn't Just Work. In fact, it didn't work at all. So now they have to decide which AOT-compiling JVM to run and figure out how to support it. I suppose that Excelsior and gcj (eek!) would be other options.

      My main point here is that, when low latency is involved, a lot of people cite the existence of high-quality real-time JVMs as evidence that Java is a good choice. These JVMs exist, but they are by no means panaceas, and users of Java for real-time or low-latency work will need to make a real technical and monetary investment in dealing with them. Hotspot is not (yet?) appropriate for this kind of thing. Oddly, .NET seems be in better shape here, at least in terms of AOT compilation.

    3. Re:Warm up is a big deal by Anonymous Coward · · Score: 0

      You can workaround this by exercising warm up in a generic way:
      1) Set a "WarmUpExercise" flag to true which makes data be stored/updated to a dummy place
      2) Simulate a couple of days or a week of operations
      3) Set a "WarmUpExercise" flag to false which makes data be stored/updated to the real place again

  57. The need for speed by Anonymous Coward · · Score: 0

    I have worked on a number of trading systems and other real time data acquisition solutions.

    In low latency environments going native is the only way to go. In some super low latency environments the code is written in Assembler aka machine code. The compiled code (exe's) are reviewed for excess code introduced during the compiling in hex. The application run thru a number of stress tests to analyze IO, cpu, memory and network utilization. A strong developer understands at a very low level how these resources get used and their costs to speed.

  58. Re:Troll much, slashdot? by mark-t · · Score: 3, Interesting

    This. I've actually personally witnessed a case where a java test application outperformed a (roughly) equivalent C++ application by a startling amount. The two applications were more of a benchmark program than a real app, since it was only testing the timing characteristics of allocating many thousands of objects on the heap, discarding some of them, allocating more, then discarding more, and so on.... The C++ version used the default new and delete operators, while the java version just used the normal new keyword and left the discarding of memory of old objects to the GC. The Java version outperformed the C++ version by more than a factor of 10. Altering the C++ version so that it used custom new and delete operators for the objects, pooling unused objects instead of always just returning them to the heap as the default delete operator did, the C++ version of the application sped up considerably, outperforming the Java version only slightly over a period of about one billion allocations. In consideration of this experience, I think that one is left with answering the question for themselves of whether spending the extra time to specifically optimize a C++ program is truly worth the marginally improved performance. Sometimes it might be... but sometimes it won't.

  59. Real time Smalltalk (Kind of like Java!) by gp824 · · Score: 2

    I built a real-time interface to some hardware in Smalltalk 20-years ago! (Yikes!) Since Java and Smalltalk have the same GC theory (at least, simplistically), some of my experiences would translate. I also spent 5-years running high-performance, low(ish) latency stuff in Java too. The simple rules of low-latency Java (or Smalltalk) are: - Create less garbage. Don't tell me that the GC is an issue when you are creating huge garbage. If your application is running in a tight loop (small amount of code being run a LOT of times), spend time on understanding the GC generational model... create only small temporary objects, and really focus on understanding where every object goes. If you can avoid the stop-the-world gc from kicking in (and you can), then most of the issues go away. - Force a GC before you go into low-latency land. This was something I could do in Smalltalk 20-years ago... I would force a GC right before I went into time-sensitive stuff. - Define what you mean by low-latency. I've worked on major systems (100s of millions of financial transactions per day with strict latency requirements) where there was a team dedicated to it, and frankly, Java wasn't nor never would be an option. (In fact, we worked with mainframe operating systems people can't even name anymore!) However, most people don't mean that when they say low-latency. - Finally, if what you really mean is low-latency measured in 100s of milliseconds, that isn't really hard and Java application servers do that in their sleep now. (I've build business transactional applications that do 100,000 transaction with 700,000 SQL calls per second on some standard software and some beefy hardware) Just work inside the best practices space of these products. It is very easy to say "Java doesn't perform" when your code is crap.

  60. Re:Troll much, slashdot? by serviscope_minor · · Score: 1

    Note:

    I'm not bashing java. It's an OK language (not my favourite, not my least favourite) and there are many others including much more fun ones for the VM. It does decent stuff and I often use Java programs (minecraft and ImageJ are particularly high on the list).

    --
    SJW n. One who posts facts.
  61. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    Java is slow because it is Garbage-Collected, not because it runs in a Virtual Machine.

    Allocating and deallocating memory takes time too.

    With C/C++ you can choose to allocate a huge amount of memory and skip all the allocation and deallocation. With Java you can also allocate a huge amount of memory, don't do too many object create/dispose and don't garbage collect at all.

    You need to realize this is HFT. You don't trade 24/7. Doesn't matter if you end up using 256GB of memory at the end of the day. You can start again the next day.

    So why would Java be slower in this case?

  62. performance is not black and white by Anonymous Coward · · Score: 0

    Being a big "C" booster these days, most of my hate is reserved for C++. It is a language with no home. Overly complicated, not as lightweight as C, and not as easy to use as Java or .NET. I could speak at length about its problems. But this post is about Java :)

    I've done Java for many years, and also C and C++, so I feel I'm qualified to comment. When we're talking performance the answer really is, "it depends". It depends on how your program is written and where the bottlenecks are. Java is actually amazingly fast at certain operations. For example, memory allocations and deallocations. That is because it is mostly allocated up-front. It can actually beat C/C++ programs here because, let's face it, malloc, new, and friends are not really speed fiends. So if memory allocations are your bottleneck, Java's your thing. Also, let's not forget that a better algorithm written in a so-called "slow" language will beat a poorer algorithm written in a faster language. So you have to make sure you're comparing apples to apples.

    If your program does a lot of disk or network I/O, the whole performance question is a wash and it comes down to hard drive or network card performance.

    If your program is CPU bound, C/C++ is the best, however Java has made improvements here over the years and it's not as bad as everyone thinks.

    Having said that, a lot of Java's features come at the expense of massive memory requirements. That in itself can slow down the machine and cause it to thrash, or swap a lot more than is strictly necessary. I believe this is where a lot of people have the impression that Java is "slow". For example, on windows the kernel has a tendency to swap out Java programs aggressively and take forever to swap them back in. So your Java UI is sitting there, unresponsive, for several seconds after an un-minimize. That's not really a problem with traditional "performance" per se. Just latency issues and memory hogs.

    In conclusion, C is still the best :) However if your users have a hojillion jiggabits of teh ramz, then feel free to write everything in Java.

    1. Re:performance is not black and white by gl4ss · · Score: 1

      ..jiggabits of ram use isn't inherent for java as such.
      it's if you put in gigabytes of libs..

      anyhow, maybe they should look for guys who used to do j2me programs, because, uh, you can write java so that you don't trash the gc stupidly and get away with pretty nice things in 300kbytes of heap..

      --
      world was created 5 seconds before this post as it is.
    2. Re:performance is not black and white by Mr+Thinly+Sliced · · Score: 1

      Being a big "C" booster these days, most of my hate is reserved for C++. It is a language with no home. Overly complicated, not as lightweight as C, and not as easy to use as Java or .NET. I could speak at length about its problems.

      I'll be the first to admit to the myriad of problems with C++ (compilation speed and difficulty refactoring being my pet peeves) - but it has things that just make life more pleasant over C:

      * RAII
      * Standard library for algorithms, structures and so on
      * Abstraction using templates are free - (well, one byte on the stack) and let you do (admittedly sometimes crazy) flexible things
      * Abstraction at all
      * Exceptions

      You're welcome to your opinion, of course. I feel that C is overly simplistic and encourages re-implementation of the most mundane of things.

      One look at things like GObject and GTK should at the very least make you question the sanity of accounting for every little thing. C doesn't leave you any choice - you must micromanage everything.

  63. Re:Troll much, slashdot? by Hatta · · Score: 1

    including C range bounds checking (to make it as safe as Java),

    Those extra cycles to make the code safer will cost an HFT firm tens of thousands of dollars. C is a better choice for these people *because* it allows them to cut corners. I mean, who cares if a bug in your program crashes the exchange when the exchange will just let you reverse the trades?

    --
    Give me Classic Slashdot or give me death!
  64. Re:Troll much, slashdot? by elfprince13 · · Score: 1

    And you'll notice even on your linked counterexample there are 5/11 examples where Java is within the margin of error on CPU time. Take the time to go back and read the link I posted. "Java vs C" goes back and forth depending on the algorithm in question and the cache characteristics of the target platform.

  65. Please do by Anonymous Coward · · Score: 0

    i would applaud the proverbial footshooing by a company whose business model is competing with others to rig a market.

  66. Re:No! It can't be! Java is slow, I tell you! Slow by Anonymous Coward · · Score: 0

    Those people who have moved from Java to JavaScript by way of Ruby say that Java is slow, even slower than JavaScript. It must be true. They wouldn't be lying or misinformed, would they?

    Nobody has ever said JavaScript or Ruby was faster than Java in the history of human language, until your incredibly stupid comment denigrating those that you believed had. Congratulations.

    The argument has always been that Java is slow compared to languages such as C and C++. And back in the day, it was by a lot. Today, it technically still is, but not enough that it matters at all as this article is pointing out, and in some cases it's actually faster.

  67. Please, God, not this AGAIN... by Anonymous Coward · · Score: 0

    You can write very slow programs in C++. You can have awful performance from a Java program. At the end of the day, it depends on what you want to build, and what your constraints are: for some things, it may indeed be "easier" to write a low-latency system in Java, but how predictable do you need the performance to be? What kind of frameworks are you allowed to use in your "comparable" C++ program? They're very, very different beasts and make vastly different promises about performance and use of resources. In particular, C++ lets you control exactly what happens to resources in a deterministic way, and this can have many advantages. It's already been pointed out that the core of JVMs are typically written in C++, so what makes anyone think that C++ is /unsuitable/ for this? One of the interviewees thoughtfully mentioned teams "...of mixed ability": if you have programmers who aren't that good with C++, perhaps Java's the quicker route from A to B. But, a competent C++ developer will hopefully suggest that you measure the results.

    Where's the actual data?

  68. Re:Troll much, slashdot? by serviscope_minor · · Score: 3, Interesting

    And you'll notice even on your linked counterexample there are 5/11 examples where Java is within the margin of error on CPU time.

    Yeah and in the rest C++ is quite definitively faster. In other words as I claimed, C++ is either the fastest or within a small percentage, across the board. There are precious few examples where C or C++ is substantially outperformed by another language (and in almost all of those precious few examples, it's Fortran) and plenty of examples against just about any other languages where it is a clear winner.

    Take the time to go back and read the link I posted. "Java vs C" goes back and forth depending on the algorithm in question and the cache characteristics of the target platform.

    I did though the one I posted has much more recent results and no dead links. All the benchmarks are similar. In some cases C++ is slightly otuperformed by Java, in other cases C++ substantially outperforms Java.

    Mostly it doesn't matter.

    But when people routinely benchmark against Java rather than C++, then I'll accept Java as the faster language.

    --
    SJW n. One who posts facts.
  69. FPGA's by Anonymous Coward · · Score: 0

    VHDL and/or Verilog on a Virtex chip, algorithms in C run SLOW compared to FPGAs.

  70. Re:Troll much, slashdot? by Xest · · Score: 1

    Oh god, not this again, this isn't the first time you've made this sort of comment about Java vs. C/C++ and had it pointed out to you how wrong you are.

    Then you go on as usual and complain about how unfair it is that you can't get a software development job and claim it's about the unfairness of H1-B and how bad your country is and whatever other excuses you come up with. If you can't even get right what even a bottom of the pile H1-B hire would then what do you expect?

    Please read the responses others have given you, they're examples of the few times Slashdot's comment system is great because they're full of people who know what they're on about explaining why you're wrong. Unless you're willing to learn from this sort of thing you're going to forever struggle to find that software engineering job and yes, H1-Bs are going to get them instead of you.

    It's an interesting topic as to why Java performs so well now and well worth a read. If you really want to be a developer then you'll find it interesting educating yourself on this. If you don't then maybe software isn't really where your heart is at anyway?

  71. Scala by Anonymous Coward · · Score: 0

    If you prefer Java, you could take a look at Scala.

  72. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    Yes, Java can be compiled. It can also be run interpretted. Either way, it runs in a Virtual Machine

    Wrong. You should learn to look things up before you post. e.g. Google: Java native compile

    Clueless moderators modding you informative on a topic they know nothing about.

  73. Re:Troll much, slashdot? by serviscope_minor · · Score: 1

    In consideration of this experience, I think that one is left with answering the question for themselves of whether spending the extra time to specifically optimize a C++ program is truly worth the marginally improved performance.

    Probably not in general if the performance gain is marginal, though you've missed one very large aspect of C++ that idiomatically, small temporary objects are allocated on the stack, not the heap, and that's completely free.

    In other words, C++ has a worse heap allocator and the properties of C++ make it harder to write a fast one compared to Java, but by default C++ doesn't use it nearly as much as Java anyway.

    If you use a library such as Eigen for small, fixed sized matrices and vectors, it's particularly noticable as for even really complex stuff, no heap allocations are preformed. Also, C++ can easily pack unboxed objectes into arrays which makes a substantial difference in locality and number of allocations.

    --
    SJW n. One who posts facts.
  74. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0
    PHP isn't Java. PHP has its own runtime/VM that isn't in any way related to the JVM. Your example is entirely spurious. The JVM really is pretty fast these days. To pick another Social Media example at random Twitter has moved from Ruby to Java and Scala (both JV M languages) for performance reasons amongst other things.

    Java is a lightweight language. It cannot, and will not ever be as fast as C/C++ because it is an run time interpreted language that additionally runs in a virtual machine.

    Well sort of. Conversely there are a bunch of optimisations that the JVM can do which are more-or-less impossible to do in c/c++. It is certainly the case that writing very performant Java is quite tricky and there are a bunch of things you need to understand (why warming up the JVM is a good idea, getting all your classes into permgen to avoid IO, how to avoid cache misses, how GC works on so on).

    I'm aware that no-one commenting on /. reads the article, but did you even read the summary? The quote (actually from Todd Montgomery) quite clearly says that Java is a bit slower than c/c++. The point is that the difference is small enough the advantages Java has in terms of time to market out way the disadvantages.

    I am forced to conclude that the slashdot editors are trolling us by approving such a patently absurd and idiotic article.

    Hate to say it, but I'm forced to conclude that you are an idiot.

  75. Re:Troll much, slashdot? by TheLink · · Score: 1

    round trips occur every time you call a function/method and the stack has to be saved..

    Is this always true? Can't the compiler unroll that, or the CPU store the stack info somewhere fast?

    I personally find it weird that many systems still push parameters onto the stack and then call the function. That's mixing code and data. Very unhygienic. Security problems and potentially poorer performance.

    --
  76. lousy for numerics by stenvar · · Score: 0

    It doesn't matter how much you tweak the JIT or the GC, Java remains a lousy choice for numerical algorithms and statistical modeling. And the Java community in those areas is pretty weak too. Even if it weren't faster, it still is easier to write and debug those kinds of algorithms in C++, and there are tons more libraries available too.

  77. Re:Troll much, slashdot? by Anonymous Coward · · Score: 1

    You mention Java's heap allocator as "excellent" and "very fast"; one reason why is because, for most allocations, it's essentially equivalent to that stack pointer bump you touted as an advantage of C/C++.

    One of the positive impacts of garbage collection is that it allows you to coalesce the deallocation phase, which means you don't pay it at all on function exit. Java can also be very aggressive about inlining function bodies (even non-private/"virtual" methods can be inlined in many cases), while you need to be more careful in C/C++ to ensure that the optimizer is allowed to do this, and for virtual methods, it's simply not possible because the optimizer can only do static analysis (at least, not without a much fancier C++ runtime than I've ever seen a compiler use).

    Now, I program in all three languages, and I'm not saying Java is a superior language in every respect, particularly when it comes to performance (I would think garbage collection pauses would kill any low latency use, but there are workarounds for that), but it does have interesting performance advantages as well as performance disadvantages. It's not just a simple matter of "more safety" = "less performance" in every case.

  78. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0, Troll

    Everyone is forgetting two of the most important aspects: training and cost. It takes a lot more time and money to train a C++ developer to outperform a Java developer. With equal training, I'd assume the Java developer will develop faster and produce more maintainable code. But I'm not a C++ master so I'm not 100% sure.

  79. Javolution to help manage latency by Paul+Fernhout · · Score: 1

    http://javolution.org/
    "Javolution real-time goals are simple: To make your application faster and more time predictable!
    That being accomplished through:
            * High performance and time-deterministic (real-time) classes such as fractal-based collections supporting extended views, closure-based iterations, map-reduce paradigm, parallel computations, etc. Performance of fractal structures (e.g. worst case execution time) is comparable to standard structures for small sizes, but significantly improved for larger size (e.g. FastTable random insertion/deletion in O(Log(n))).
            * Most parallelizable classes (including collections) are either mutex-free or using extremely short locking time in order not to impact the worst case execution time of high priority threads (works well only if the VM supports priority inheritance).
            * Context programming in order to achieve true separation of concerns (logging, performance, etc).
            * Straightforward and low-level parallel computing capabilities with ConcurrentContext.
            * Struct and Union base classes for direct interfacing with native applications (e.g. C/C++).
            World's fastest and first hard real-time XML marshalling/unmarshalling facility.
            * Simple yet flexible configuration management of your application.
            * Javolution makes it easy to port any Java application to C++ for native compilation (maven based) or to write Java-Like code directly in C++ (see Javolution C++ Overview)."

    Javolution is written and maintained by Jean-Marie Dautelle.

    So far Javolution has worked fairly well on a big project with soft real-time needs (although used mainly for the struct and union classes, which is what I originally suggested using it for). Perhaps these sorts of classes should become part of the Java standard library somehow?

    --
    A 21st century issue: the irony of technologies of abundance in the hands of those still thinking in terms of scarcity.
  80. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    Writes are asynchronous on most CPUs, so as long as you don't do too many of them and overload the bandwidth for writes it's not necessarily a big deal to write to your own stack. The stack tends to be in cache, so that helps. Sometimes compilers can do inter-procedural optimization to have functions use different sets of registers so that nothing needs to be written to the stack, but that is only going to work close to the leaves of the call graph and you can't depend on your compiler being able to figure such stuff out. Inlining is the most powerful compiler tool for eliminating function call overhead, but too much inlining has bad consequences as well. At the end of the day, calling functions requires storing some data and that date has to go somewhere. Since registers are limited and you can call many functions recursively, the data has to go somewhere and that somewhere is the stack. There is no way around that in the general case.

  81. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    In C and C++ you can usually set things up so that allocation and deallocation almost never happens, so the cost for that in C and C++ can easily be about zero after a wam-up phase. This usually involves a higher memory use than you'd otherwise need, but not as much higher as what you need to get reasonable performance out of a GC. You can of course do the same thing in Java, but then you're no longer taking advantage of having a GC at which point you might as well be writing in C or C++ anyway.

    In C and C++ you can also layout the memory in just the right way. The Java allocator is more likely to make the right guess about how to layout your memory than the native allocator is, that's true, but neither of those can beat an optimal manual layout.

    It's true that generally native programs aren't compiled for a specific CPU. Nothing prevents you from doing that, though, so that's not a fault of native languages.

    Your program was faster because you wrote it better, not because it was written in Java. Which is usually a sign of what this story is about: resources were limited either because of time constraints or because the companies involved didn't want to spend the large amount of money required to make a native app as fast as it can be. Java wins if you haven't got sufficient time and lots of money.

  82. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    C also uses memory management. malloc/free are blocking operations that take CPU cycles on the calling thread! Allocation in the JVM is extremely cheap (a single memory write in the best case) at the cost of more overhead for freeing it. But GC runs in parallel on a different thread and does not block the application code. Look at the modern GC algorithms! They are really amazing and very well suited for multi-core machines.

    Java transaction performance is bounded by transaction duration and memory use per transaction. Seriously, if your machine swaps get more RAM. We run all our servers without swap.

  83. Python has advantage of Java by Roger+W+Moore · · Score: 1

    If I want to write a program quickly, I write it in Python even though I know the program will run quite slowly.

    Which is what I do too knowing that if I need to speed up the code I can rewrite parts in C/C++ and compile them and then call them from Python. This, as far as I understand, is simply not possibly in Java. So if you code in Java there is no way to compile parts of it to get a needed speed boost.

    In addition, while anecdotal, by experience with Java apps is that they are incredibly slow, rather unresponsive and crash often. No clue whether that is the programmers fault or Java's but it seems a common 'feature' of many java apps I've seen on the web. So I really am completely amazed that anyone would consider this for a low latency system given the speed and reliability issues that seem to abound with apps written in the language. The last time I coded a low latency system (in C++) we disabled timer interrupts to the Linux OS to prevent the process getting swapped out - somehow I cannot imagine there is a way to do this in Java!

    1. Re:Python has advantage of Java by Anonymous Coward · · Score: 0

      Which is what I do too knowing that if I need to speed up the code I can rewrite parts in C/C++ and compile them and then call them from Python. This, as far as I understand, is simply not possibly in Java. So if you code in Java there is no way to compile parts of it to get a needed speed boost.

      http://en.wikipedia.org/wiki/Java_Native_Interface

      Judging from the sources of that article, the native interface seems to have existed at least 15 years already. I have not used it myself, but it certainly makes it possible to call C/C++ code from Java. Although, without even checking the Python case, I guess it is much easier and cleaner to do in Python.

    2. Re:Python has advantage of Java by Anonymous Coward · · Score: 0

      I suppose you haven't heard of JNI.

    3. Re:Python has advantage of Java by Anonymous Coward · · Score: 0

      http://en.wikipedia.org/wiki/Java_Native_Interface

      The last time I coded a low latency system (in C++) we disabled timer interrupts

      That's not low latency; that's real-time.

    4. Re:Python has advantage of Java by codealot · · Score: 2

      "...by experience with Java apps is that they are incredibly slow, rather unresponsive and crash often."

      Then you have no experience with Java application development. Or you're trolling, whichever.

      Or possibly you're talking about browser applets, but that's not what this story is about.

      If you don't have knowledge on the topic to contribute, why post at all?

    5. Re:Python has advantage of Java by Anonymous Coward · · Score: 0

      Which is what I do too knowing that if I need to speed up the code I can rewrite parts in C/C++ and compile them and then call them from Python. This, as far as I understand, is simply not possibly in Java. So if you code in Java there is no way to compile parts of it to get a needed speed boost.

      Take a look at the JNI (Java Native Interface) and JNA (Java Native Access).

    6. Re:Python has advantage of Java by Anonymous Coward · · Score: 0

      Which is what I do too knowing that if I need to speed up the code I can rewrite parts in C/C++ and compile them and then call them from Python. This, as far as I understand, is simply not possibly in Java. So if you code in Java there is no way to compile parts of it to get a needed speed boost.

      Actually you can use the JNI to write your code in native code and hook it into Java. Similar functionality exists for .Net.

    7. Re:Python has advantage of Java by Anonymous Coward · · Score: 0

      Just weighing in. My own experience with Java mirrors GP. We have a ton of "enterprise" Java applications, from multiple *large* vendors, that we run at work, and they are the most buggy, slow, crashy things I have ever experienced. These are server-side java.

      Also agree with parent that client-side java applets are complete shite (This happens frequently, but the first time it happened it nearly gave me a heart attack. Brocade uses a java applet to manage their FC switches. I went into zone management, and 90% of our zones were missing. Restart everything java, and the browser, restart the applet, and zones are there-- fucking ridiculous).

      Also, it seems the cool kids doing Java development think that creating user readable logs is for losers. They just let uncaught exceptions with stack traces go to the logs, because those are so much better for their customers trying to get their Java clusterfucks to run half reliably.

      Is the language at fault? ::shrug:: But, it sure seems that ?most/all? of the people who use it don't know what the hell they are doing.

      Now about that python thing. Python has a lot of weaknesses too. But, I came to rant about Java ;)

    8. Re:Python has advantage of Java by codealot · · Score: 1

      We have a ton of "enterprise" Java applications, from multiple *large* vendors, that we run at work, and they are the most buggy, slow, crashy things I have ever experienced.

      Alright, I'm with you. I'll bet that any apps you get from those "large" vendors are going to suck, Java or otherwise.

      And "enterprise" software? Our company is arguably an "enterprise", though I have yet to use any enterprise software that felt it was designed for us. I don't get that market at all. Don't sell me software that does everything, give me instead something simple that integrates cleanly with all the other software I already use.

      Try hanging out in the open source circles, like some of the Apache Java projects, if you want another perspective. Then again, you probably don't. Just trust me... lousy software that happens to be written in Java isn't a reflection of Java.

    9. Re:Python has advantage of Java by Thiez · · Score: 1

      > So if you code in Java there is no way to compile parts of it to get a needed speed boost.

      Modern VMs already compile when you need a speed boost.

      > The last time I coded a low latency system (in C++) we disabled timer interrupts to the Linux OS to prevent the process getting swapped out

      Did that really make a meaningful difference? I imagine the interrupt handlers would have very little code and would never ever result in pages getting swapped out.

    10. Re:Python has advantage of Java by Roger+W+Moore · · Score: 1

      If you don't have knowledge on the topic to contribute, why post at all?

      I have considerable experience with developing low latency systems as I briefly mentioned in the article. I have no experience with Java development but I do have experience with the 'fruits' of such development and, for the most part, they are appallingly bad. These are not just browser applets but java programs ranging from physics demonstrations and programs for drawing Feynman diagrams to video conferencing and learning management solutions. Based on those experiences the only conclusion I can reach is that either the Java platform is incredibly slow and buggy or that Java developers are somehow far below the standard of developers for other languages.

      Since I can see no reason why the latter would be the case my assumption is that the platform is the cause. However I can honestly say that my experience with using Java programs has been so bad that nowadays I will avoid it like the plague if there is any alternative (which thankfully there often is). I suppose it is possible that things have improved but I have not heard of any reason why I would expect them to.

      I should also add that this is not just my experience but that of my colleagues as well - several times I have been in meetings where some bright spark has suggested implementing some solution in Java and it routinely gets shot down by multiple people in the meeting citing the same issues (slow, buggy etc.). So, given this experience, the suggestion of trying to do low latency programming (which I have done in C/C++ with hardware-level knowledge) in Java sounds extremely surprising. I would not even attempt it in python but I can at least see how it might be achieved.

    11. Re:Python has advantage of Java by jma05 · · Score: 1

      > This, as far as I understand, is simply not possibly in Java

      Its certainly possible for Java. There is JNI... and SWIG supports it. You can also directly compile Java to native code using GCJ or other commercial AoT compilers. It's usually just not worth the trouble though and sometimes the performance is even worse.

      You can get a major boost in Python with a native extension. Modern Java is already fast (regardless of what you might have heard). So the extra complexity is usually not worth it.

      > slow, rather unresponsive and crash often

      Framework bloat and misuse. The JVM itself is robust. You might as well blame C/C++ for buffer overflows and crashes.

    12. Re:Python has advantage of Java by NeoMorphy · · Score: 1

      I suspect he does have knowledge on the topic.

      Personally I have seen countless servers run out of memory and it's usually java, DB2, or Oracle. When it was DB2 or Oracle it was usually a mistake made by the dba, but java apps like to grow to their maximum java heap size and then spend a lot of cycles in garbage collection. I get an alert, log onto the server, check to see who the biggest memory user is and 19 times out of 20 it's java. Doesn't seem to be a solution for it other than to schedule nightly recycles of the applications.

      I have to be careful on my work laptop because some of the applications I have to use run under java. They are easy to identify because they use more memory than any other application. On the bright side I can now justify an 8GB upgrade.

      How many people can recall watching a program get ported to java and then watching their PC's memory and cpu usage dramatically increase?

  84. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    Read the benchmarks at http://www.techempower.com/benchmarks/ and http://benchmarksgame.alioth.debian.org/

    Well-written Java code running on the JVM long enough for the Hotspot Just-In-Time (JIT) to optimize it consistently runs within 2x of the speed of well-written C++ code. The JVM uses more memory, in some cases as much as 40 times more. But for speed, Java is awfully close to C++ and positively demolishes PHP.

    If you don't believe it, find counter-benchmarks.

  85. Re:Troll much, slashdot? by BlackHawk-666 · · Score: 2

    Cheap RAM means you can run bigger and faster C++ apps too you know, not just Java. C++/C will beat java in almost every test that counts because skilled C/C++ developers can write code that handles memory better than most GCs.

    --
    All those moments will be lost in time, like tears in rain.
  86. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    There's a potential that your benchmark program had errors - the JVM Hotspot JIT optimizer can detect and eliminate dead code. e.g.
    for (int i = 0; i
    It looks like you're checking how fast Java can do some simple math operations, but the JVM might determine that the value of j never escapes the loop and optimize the complete loop out of existence. I read about this kind of frequent problem benchmarking Java in Java Performance by Charlie Hunt.

  87. Java or C# by NCG_Mike · · Score: 1

    I've seen trading platforms in Java (Island) and was surprised at the number if transactions per second. I don't see Java jobs in London that much but lots of C#. Maybe that's UI work. Bloomberg are very C++ orientated and they're known for their trading platform. Lots of Boost in there AFAIK.

  88. Re:Troll much, slashdot? by BlackHawk-666 · · Score: 1

    I'll give a concrete example.

    Many years ago I had to write code to pull documents across an HTTP link using XML. The docs could be up to 10MB is size, though most were much smaller. I could grab several at a time each polling of the upstream server - up to 20.

    Now, in C# or Java you might create a document class that could store the docs, and dispose of it after finishing. This could lead to heap exhaustion / GC / management as large amounts of memory were allocated and deallocated.

    In C++ I simply made a buffer as large as the biggest document I wanted to deal with, and kept it in RAM the whole time. The buffer was overwritten many times a second as needed. Since it was always the same memory, there was no heap juggling required. The program ran so fast and smoothly that some financials accused us of cheating since we moved the data far faster then they did.

    Sure, you could have written it in Java, but the GC would have taken a thrashing.

    --
    All those moments will be lost in time, like tears in rain.
  89. Re:Troll much, slashdot? by TheLink · · Score: 1

    . Since registers are limited and you can call many functions recursively, the data has to go somewhere and that somewhere is the stack. There is no way around that in the general case.

    No way? Why not two stacks? One for addresses and one for data. That way even if there is an error you don't end up returning to an "attacker" supplied address (via data). The program might still crash, but it is less likely to "execute arbitrary machine code of the attackers choice" which seems to happen too often.

    And also arguably if you keep the data and address stacks separate so that the address stack only ever contains addresses it might be easier to do optimization tricks.

    --
  90. Re:Troll much, slashdot? by serviscope_minor · · Score: 1

    I program in many languages, and I'm not saying Java is inferior.

    one reason why is because, for most allocations, it's essentially equivalent to that stack pointer bump you touted as an advantage of C/C++.

    Many, not most. For short lived objects, it bumps the pointer for each allocation and every so often scans the new object pool and decides to move them to a larger pool (generational collection).

    In C++ the compiler knows the size of the stack frame, so when the function is entered, there is already exactly as much space as needed. The C++ one is still cheaper because it is completely free.

    One of the positive impacts of garbage collection is that it allows you to coalesce the deallocation phase, which means you don't pay it at all on function exit.

    With the standard allocator, you pay for large objects only on function allocator. For small ones, they dimply disappear as the stack pointer is ajusted to point back to the callee.

    Java can also be very aggressive about inlining function bodies (even non-private/"virtual" methods can be inlined in many cases), while you need to be more careful in C/C++ to ensure that the optimizer is allowed to do this,

    I disagree: in C++, all methods are non virtual by default, so almost everything is a candidate for inlining. The C++ compiler inlines a lot and actually with its heavy use of functors/lambdas, modern idiomatic C++ code relies on that.

    and for virtual methods, it's simply not possible because the optimizer can only do static analysis (at least, not without a much fancier C++ runtime than I've ever seen a compiler use).

    GCC does a fair bit of static devirtualisation. I suspect it is not as good as the JVM though, because the JVM can recompile long functions statically.

    There are techniques to mitigate this in C++, for example writing loops with function calls using the curiously recurring template pattern, and putting that lot in a virtual function. The end result is much the same as what the JVM does: you get one compiled devirtualised function for each class.

    The java solution is much easier to use (all done for you) where as the C++ one is guaranteed to work in all edge cases since you manually specify the devirtualisation.

    That said, I personally use very few virtual functions in my C++ code.

    --
    SJW n. One who posts facts.
  91. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    dammit, the code got eaten because of the less than / greater than. Let me try again:
    for (int i = 0; i < Integer.MAX_INT; i++) { int j = i; j--; j-= j/3; }

  92. Re:Troll much, slashdot? by Anonymous Coward · · Score: 1

    I tend to agree in general. However, for the employers in question, the cost difference between top-notch Java vs. C++ developers is a pittance compared to the potential earnings from the algorithms. Also, they can afford to buy fully trained developers (more to the point, they can't afford not to), so the inequity in training time to get to excellent competency isn't a problem for them. This is somewhat tangential to the point of TFA, though.

    - T

  93. Ever heard the word "REUSABILITY"?? by Anonymous Coward · · Score: 0

    Guess what? A skilled programmer can write code (in any language) that would not require GC (or delete) of a single object during the entire execution of a process. And that execution can be measured in months or even years.

    And it is as simple as designing a class to be fully REUSABLE without having to delete it.

    1. Re:Ever heard the word "REUSABILITY"?? by Anonymous Coward · · Score: 1

      That is nowhere near the standard meaning of the term "reusability" in a programming context.

  94. Java JNA helps with low latency portions... with C by Anonymous Coward · · Score: 0

    Here's something wild. I use Java JNA with Jack Audio (jackd) on Linux which allows me to have the C/C++ based Jack Audio to perform callbacks (including the one that feeds wav data into a Jack channel) using JNA.. I never expected that Java could handle it that fast but it's really nice.

    So for performance sensitive portions one can use C/C++ and Java for the window dressing *IF* those portions don't "pop" fast enough...

  95. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    http://benchmarksgame.alioth.debian.org/u64q/java.php

    If you switch from single-core to multi-core, Java's worst performance against C++ goes from 4x the C++ speed to 2x, and in some cases it's equal. That's still behind, I don't dispute that. But it's damn close. If C, C++, and Fortran are the consistent three kings of performance, then Java (when running warmed up) is probably second and in a similar category to Go and Ocaml - close enough behind the kings that many high performance applications might benefit from the enhanced developer productivity more than the extra speedup.

    Other people - not you - have tried to group Java performance in line with PHP, Perl, Python, Ruby, etc... that's clearly inaccurate.

  96. Re:Troll much, slashdot? by Ken+D · · Score: 1

    ... or you could have written it in Java the exact same way and kept recycling a large buffer over and over without any garbage collection whatsoever..

  97. Re:Troll much, slashdot? by DamonHD · · Score: 1

    Agreed.

    I run my primary server (which includes my mail and DNS and static http servers, as well as a largeish Java app) on a swapless system. So swapping is never an issue.

    And indeed not being forced to free synchronously as the stack unwinds can make Java faster than C++ for example, I second that.

    And this "Java is slow because (insert assumption)" stuff is really really old. I can write good or bad code in Java, C, C++, C#, even asm, and I do write regularly in all of those, including real-time code, with cycles being counted where necessary, on hosts with CPU speeds and memory sizes ranging over several orders of magnitude.

    Rgds

    Damon

    --
    http://m.earth.org.uk/
  98. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    Our software would run 1k-2 warmup/test updates through the system after startup before it went into live trading mode, by then all the critical paths had been fully optimized and compiled to CPU specific instructions.

    In addition to what the other AC wrote, some C++ compilers, including GCC, support built-in PGO.

    Also, while the other AC mentioned that compilers typically support targeting a particular CPU, that is usually at the rather coarse level of CPU model/family. However, if you know the specific CPU characteristics of the target systems, you may be able to organize the data structures to improve the usage of on-die memory. This can often be implemented so that adjusting for a different specific CPU architecture is almost as simple as a recompilation.

    - T

  99. Kind of by Murdoch5 · · Score: 1

    Java can have relative low latency but can never match C or ASM. If you have a soft real time system that doesn't need pin point real time control then I would say Java is fine and a great choice, however if you need tight real time control and you are making a hard real time system then I would say Java and C++ don't work, C and ASM are still the best choices you have great embedded language. C and ASM can do everything that you need and more. I'm not saying Java doesn't have a place in the embedded world but I think it gets to highly valued.

    1. Re:Kind of by Anonymous Coward · · Score: 0

      Absolutely... C is fast and ASM even faster :) JNA allows C to coexist with Java .... tight real time control in C, window dressing in Java... C++ is a PITA.

    2. Re:Kind of by Anonymous Coward · · Score: 0

      You obviously don't know how to properly use C++. In fact, it does simplify and "securify" lots of things without losing efficiency relative to C.

      Just RAII is extremely valuable.

      Learn how to properly use C++ - it is not "C with classes". You need to understand the elegant and efficient C++ idioms such as RAII or templated container classes and the type safety that brings. Don't worship STL and create your own containers at some point.

  100. Re:Troll much, slashdot? by DamonHD · · Score: 1

    You can do exactly the same in Java with ByteBuffers and direct memory if you really want to, for example, and never GC.

    On the other hand, for the non-critical 99% of the code you can write it simply and safely and quickly and let GC clean up occasionally if need be.

    Rgds

    Damon

    --
    http://m.earth.org.uk/
  101. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    Now, in C# or Java you might create a document class that could store the docs, and dispose of it after finishing.

    You could do that in C++, too. You can also destructively modify objects in place in java. Maybe you should come up with a concrete example that actually compares like algorithms.

  102. As a Industry employee... by Anonymous Coward · · Score: 0

    10+ years on one of the big 2. I can tell you for a fact. Matching Engines run on C. java is used in customer gateways. pre-acquisition my previous exchange had java ME's. it was very unpredictable we had to run the servers under %20 load (200 or so ME's). After that we could see slow downs.

  103. ever tried compiling glibc? by Chirs · · Score: 1

    It takes a loooooong time.

  104. Re:Troll much, slashdot? by ebno-10db · · Score: 1

    Good points. It annoys me when people claim that Java is faster than C++ because they tested one of the few things where Java really shines performance wise. Basically they're writing a Java program, with its endless allocation/deallocation, in C++, and saying look, Java programs run faster on Java than they do on C++!

    Hint folks: you write C++ programs differently. Even in Java constant massive allocation/deallocation is bad form, especially when speed is important. RTFA: one of the tricks they use to speed up Java is to avoid creating a lot of garbage to be collected. Allocation/deallocation is free in any language if you don't do any of it.

  105. Re:Troll much, slashdot? by solidraven · · Score: 1

    Well, I must say it's still somewhat remarkable how Fortran compilers generally manage to beat C/C++ compilers their collective behinds when it comes to processing large quantities of data. Then again, Fortran tends to be aimed at big data and high performance computing these days.

  106. Java faster to code in? Really? by Gibgezr · · Score: 1

    I don't understand why people find Java faster than C++ to write code in. Any program large enough to require lengthy compiles is large enough that Java is unlikely to be a suitable candidate language, and even if you did write that triple-A game in Java it would take longer to code because of dealing with memory/performance issues.

    Directly addressing memory/handling your own de-allocation of memory answers more problems than it creates unless I am writing trivial programs and have access to some magic libraries that I don't have access to in C++. All things being equal, I can code a better program faster in C++. Now, If I was a programmer who never learned/practiced coding with pointers then sure, my Java programming would be faster, but since I am comfortable with pointers/memory allocation schemes etc I find C++ faster. I am suspicious that people who find Java faster for coding large projects are just unfamiliar with C++ and managing your own memory, or are using libraries to do all the work and just don't know of an equivalent set of C++ libraries.

    1. Re:Java faster to code in? Really? by Shados · · Score: 1

      The ecosystem is a big deal. If we're talking financial apps, the required ecosystem to interop in the distributed environment are all off the shelf. Doing SWIFT or SOAP in C++ is totally doable and there's plenty of open source or not so open source frameworks out there, but its "awkward" on the best of days (and those things suck no matter what, so you really don't want to make them suck worse).

      Also, the only real bottleneck is these type of applications is I/O (database, file system, and network). The language is almost irrelevant. You do have to pay attention to the algorithms, but beyond that, it could be in VB6 for all you care.

      I used to work for one of the "top 3" big financials, and all major languages were used in some fashion, C, C++, Python, Java, C#, F# (!!), Perl, whatever. They were always selected due to the ecosystem and total cost of ownership analysis related to what tools we'd use. Performance rarely came into consideration because the difference was insignificant for these scenarios. And those were GIGANTIC distributed systems with thousands of different physically separated services and where a difference of 0.001 second in the time it took for something to go through all of them was worthy of waking up 50 people at 3 in the morning.

      Java was the most common language because it had the intersection between distributed system frameworks (.NET actually is better for this in audited, "standard" environment ironically...it has better support for some of the open standard protocols than what the open source community spit out to this day...) and being able to cheaply scale horizontally (whoops, .NET just got kicked in the balls =P).

      That's it. If you can do these kind of things in C++ faster than in Java (or .NET, or whatever), then you don't know how to use the 2 languages equally. Talk to someone who's done REAL, similar complexity integration projects for 5-10 years in each of those, and they'll laugh at you for even hinting you could do it at the same speed in C++. Again, thats for THIS PARTICULAR TYPE OF PROBLEM. Making a game, an office suite, a browser or a rendering engine would be a totally different story.

  107. Re:Troll much, slashdot? by cowdung · · Score: 1

    As of Java 7, Java also can allocate objects on the stack automatically with escape analysis.. So in theory C++ and Java are the same in this respect. (It also removes unnecessary synchronized calls in these cases for these objects)

    As for other objects Java uses copy collectors for short lived objects that makes cleaning them up essentially free as well. In fact, it is much less expensive than C++ delete calls. C++ still has to run any destructors that are there. In Java finalizers are rare. So short lived objects are much cheaper in Java both on the stack and on the heap in terms of execution overhead related to memory allocation/deallocation.

  108. "Real Time Java" by Anonymous Coward · · Score: 0

    Wow, I can use "Real Time Java", but only if I totally rethink my code, and do lots of painful analysis, or I can just code it and C/C++ and have it "just work".

    Java, write once, profile, write again, write again, and again, and again, and the finally do it right in C++.

    Face it, real time apps do not have time for garbage collection and all that other nonsense. Use the correct tool for the job. Then again, when most code monkeys only know java, everything does look like a nail.

  109. Re:Troll much, slashdot? by jkflying · · Score: 1

    Newer JVMs also allocate objects which won't escape context to the stack.

    --
    Help I am stuck in a signature factory!
  110. Re:Troll much, slashdot? by jkflying · · Score: 1

    Java only does array range checking when it needs to, at the beginning/end of a loop or at any point where the array ends.
    See: https://wikis.oracle.com/display/HotSpotInternals/RangeCheckElimination

    --
    Help I am stuck in a signature factory!
  111. Also for catastrophic failures. by Ungrounded+Lightning · · Score: 1

    People are the most expensive cost to most businesses these days. So the marketing battle between languages focuses less on performance and more on how experienced and expensive your developers need to be. What I see being missed with this marketing is that by lowering the people quality and marginalizing your language and code quality, you are setting yourself up for maintenance, improvement, and performance costs down the road.

    Also for catastrophic failures, when a relatively inexperienced programmer does something that someone more seasoned would know to avoid and it makes it through QA to deployment before being triggered.

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
  112. Sappeur: Best of C++ and Java by Anonymous Coward · · Score: 0

    I am using this opportunity to promote a langauge of mine called Sappeur.

    This language aims to combine the strengths of Java (memory/type safety) with all the useful C++ mechanisms such as

    + Synchronous Destructors
    + Deterministic Memory Management
    + Value Arrays
    + Almost All Objects can be allocated on the stack or the heap
    + Special type support for thread-shared data types

    Here is a presentation and the manual.

    Regarding the claims "Java is already good enough", this might be true for some special cases, where memory consumption (typically at least 3 times as much as the equivalent C++ program) does not matter and the problem itself is rather primitive. My own informal benchmarking with a CSV-parser/hashtable type of program suggests that.

    But as soon as you manipulate lots of highly complex data sets, the strengths of C++ will make themselves be visible in performance, too.

    It is not a coincidence Steve Jobs (peace be upon this great perfectionist asshole) insisted on the use of a C-style language (Objective C) for Apple products. Perfection requires soft-realtime capability which you cannot get from a GC language. And probably never will, as memory management must be tailored to the problem instead of using a "one size fits all" approach (automatic Garbage Collection).

    Dipl.-Ing. Informationstechnik (BA) Frank Gerlach
    Gäufelden
    Germany

    PS: Yeah, now that I grew a little older I do think a proper CS degree matters in the I.T. world. That's why I am listing mine here.

  113. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    In a proper language like C, C++ or Sappeur, you can have value arrays and you can access your cache in the most efficient manner one can think of.

    Java is still a clunker when it comes to efficient memory allocation and layout.

  114. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    For an apples-to-apples comparison, C++ may well be fastest. But those situations don't show up very often.

    The real question is, "Given the ability level of developer I'm willing to pay for, what I want done, and the amount of time I can give the developer to do it, which language is the developer more likely to deliver an acceptable solution in?". This can depend on what people in the shop already know, it can depend on the performance requirements, etc.

    Fast ENOUGH is what matters. There are very few things in the business world that Java isn't fast enough for, and fewer where it can't deliver if low latency pieces are written in C.

  115. Re:Troll much, slashdot? by msobkow · · Score: 1

    This constant blending of "C/C++" really bugs me. There is a world of difference in the performance of a non-class based language like C and one which requires hidden instance parameters and dynamic type checking like C++ does. While you can use a C++ compiler to write C code (all methods and variables declared static), the two languages really do not compare for performance nor for ease of use.

    The big problem with C and C++ vs. Java is that it requires a lot of experience to write effective memory management with C and C++, and without effective memory management you end up leaking memory or thrashing the system allocator functions. Comparing these languages is like comparing a VW bug to a modern semi-tractor unit. They're just not equivalent in form, function, or intended market.

    In the end you have to use the tools that are best suited to the requirements of the task at hand, and in the case of C and C++ code, that includes being aware of the operating system and it's memory management approach, which Java hides from your code.

    I've seen no shortage of C and C++ code over the years whose performance sucked because some idiot directly used malloc/free for allocating small objects instead of writing proper allocators that would cache instance memory and reuse it. Conversely, I've seen Java code that tried to implement instance pools in order to override the garbage collector whose performance sucked as a result of the overhead.

    The bottom line is an unskilled or inexperienced programmer with can shoehorn crappy performance concepts from other languages into the code at hand. Blame the coder, not the language.

    --
    I do not fail; I succeed at finding out what does not work.
  116. Re:Troll much, slashdot? by Thiez · · Score: 1

    Except that you could have used the exact same technique in java, recycling the same object.

  117. Re:Troll much, slashdot? by Jerry+Atrick · · Score: 1

    Processor stacks are a near perfect candidate for caching. It's likely to exist in L1 cache for the bulk of run time, with close to no cache refills ever happening (typically you write before reading stack values). x86 CPUs are claimed to be optimised for L1 cache stack operands to be as fast as registers, essentially the stack then becomes a large set of extra registers, albeit funnelled through physical ones.

    In architectures with large register files a lot of code may never actually touch RAM at all, with only the link pointers pushed to stack for many calls and living in a dedicated stack in some cases.

    Stack frames only look like an ugly hack, they have great performance characteristics once you have good enough caching.

  118. People doing something stupid by Anonymous Coward · · Score: 0

    People doing something stupid doesn't make that thing not stupid.

  119. Re:U just read about programming instead of doing by Anonymous Coward · · Score: 0

    Wrong.

    There is no way an intelligent programmer, optimising her code, and using a static compiler to generate optimised machine code is going to be outperformed by an unoptimised program running in an interpreter that selectively recompiles parts of the program into pseudo-optimised machine code. Firstly all that runtime profiling and optimisation is itself a performance penalty, secondly the code generator of Sun JRE and Open JRE is worse than GCC or IntelCC, or clang, thirdly the C programmer has already made all the optimisations and more that the JRE could possibly make.

    If your argument had any merit whatsoever, HPC folk would be programming in Java by now instead of C and Fortran with OpenMP. Games would be written in Java.

    And I write engine code for games, I build profiling test harnesses which perform convex optimisation to select good kernels, this generates selection matrices which allow my engine to select which kernel to use based on input parameters, which is similar to how JRE's profiler works, except here I have the advantage that all the tests are run in the build process, so the profiling has already been done when it hits the users machine.

    Also if you think statistical methods can outperform rational optimisation, expect to be disappointed. Compare the BLAS implementation ATLAS, which is the highest performing statistically optimised BLAS package to any of the hand-tuned BLAS implementation: AMKL, Intel MKL, GOTO-BLAS, they all outperform ATLAS by significant amounts.

    Optimisation through understanding will always beat optimisation by statistics.

  120. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    Automatic memory management is better then manual memory management?

  121. Re: Troll much, slashdot? by Anonymous Coward · · Score: 0

    Lost his marbles?

  122. Re:Troll much, slashdot? by satuon · · Score: 1

    I meant something different - Java programs use more memory as a whole - this causes more cache misses, and also more hard drive swapping. The GC algorithms don't matter - they affect CPU usage, not memory usage. The problem is that a Java program uses several times more memory than a comparable C or a C++ program. As I said, the problem is cache misses and hard drive swapping.

    And I'm talking about my own experience running Java programs on my not very powerful laptop computer with 3 GB of RAM (no SSD) - I don't use a server at home, the only Java programs I care about are desktop applications, and I've been disappointed there. May be that's why I only hear about Java programs but never see them - because it's only used for server-side programming. I don't use servers.

  123. Re:U just read about programming instead of doing by Anonymous Coward · · Score: 0

    Can you backup those claims ? Optimizing Fortran Compilers still blow anything out of the water in scientific/engineering codes.

  124. Re:Troll much, slashdot? by dkf · · Score: 1

    Stack allocated objects are completely free.

    Point of order: stack objects are not free, they're just very cheap. However, you still need to initialize (or were you going to use something without setting it to a known state?) and you need to bear in mind that stacks are generally considerably smaller than the heap. Yes, you can do things like resizing a stack or relocating it to another area of memory when you run out, but those are operations for the extremely brave. And they're expensive too. If I suspect that I even might need them, I just use the heap from the get go as that prevents my hair-loss (and I'll layer a few thread-bound pooled allocators in, which deal with most of the cost of heap usage when stack-based allocation was originally even a candidate in the first place).

    --
    "Little does he know, but there is no 'I' in 'Idiot'!"
  125. Re:Troll much, slashdot? by serviscope_minor · · Score: 1

    I know about escape analysis.

    It won't make java as fast as C++ for the same reason that alias analysis fails to make C++ as fast as FORTRAN and for exactly the same reason.

    In both languages (Java and C++) if you create a local variable, you may well then pass it by reference to some other function. If that function is sufficiently complex, or through a virtual function call, the compiler can't tell if the reference is stored somewhere after that function returns.

    In C++ it's up to the programmer not to do that: you're providing a personal guarantee to the compiler that you're not going to do that and woe betide you if you do. In Java, the extra safety means the programmer isn't allowed to offer a personal guarantee with bad consequenced is it's wrong.

    It's much the same as restrict in C99: you promise the compiler that no aliasing is happening and it's allowed to give you bad results if it does alias.

    Not being a fan of undefined behavior, Java never does that and so optimizations are harder.

    Interestingly, though GCC does also do some sort of escape analysis on memory allocations with malloc()/free() (though not new, delete) and can in fact avoid some malloc/free pairs that don't end up doing anything.


    C++ still has to run any destructors that are there. In Java finalizers are rare. So short lived objects are much cheaper in Java both on the stack and on the heap in terms of execution overhead related to memory allocation/deallocation.

    In C++ can have lighter objects than Java. C++ has the concept of POD (Plain Old Data) which has even expanded in C++11. PODs (and in fact many classes which don't manage resources) have trivial destructors: those that have no code and do not need to be run.

    If you make a lot of temporaries of that sort then there are no destructors to be run, and deallocation is completely free because it is included at no cost in the stack pointer bump when the function returns.

    An excellent example is the Eigen library. If you work in things like 3D geometry, you end up working with many small, statically sized vectors and matrices, generally 2D, 3D and 4D. These are all basically PODs (certainly under the new rules) and as a result, despite being complex objects with interesting semantics, they are still free to allocate and deallocate on the heap.

    I have actually analysed the asm code. Interestingly, GCC can reason about the memory allocation more easily since it's on the stack and therefore it can guarantee that two arrays do not alias. As a result it can perform the most amazing amount of optimization.

    TL;DR escape analysis is great (and is equivalent to alias analysis for pointers in C and C++) and therefore I love it. It will yield performance improvements, but will never catch as many cases as stack allocation.

    --
    SJW n. One who posts facts.
  126. Personal Preference? by danknight48 · · Score: 0

    Really don't get the point of these articles. Trying to spin everyone into a orgy dispute.

    At the end of the day, the only thing that will decrease latency is your programming skill.
    Your ability to write efficient, logical code is more important than what language you use to do it.

    People who use C++ will say C++ is better, those who use Java will say Java is better.
    The only way to test this is to write a simple program in each language (using the same logic) and test it.
    Instead of having these stupid "hearsay" Java articles, why not do some benchmarks?

  127. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    What do YOU know about programming? Java and PHP, in the normal use-cases, are BOTH compiled languages, though certain stages of compilation are performed on-demand. The comparison is meaningless anyway: PHP-hating aside, of course a dynamically-typed language (PHP) is outperformed by mature statically-typed languages (C/C++). And all of this tells us EXACTLY NOTHING about how the performance of another statically-typed language (Java) might rank.

  128. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    Can you please stop with the meta comments ? Thank you. Fab.

  129. no pause is better than deterministic by jeske · · Score: 1

    Azul Zing and their Pauseless and C4 collector algorithms are leading the pack of pause-free JVM GC options at the moment..

    http://paperhub.s3.amazonaws.com/d14661878f7811e5ee9c43de88414e86.pdf

    http://www.azulsystems.com/

  130. Re:Troll much, slashdot? by Anonymous Coward · · Score: 0

    There are a few problems with PGO in respect to JIT. Like the wiki article says: "the sample of data fed to the program during the profiling stage must be statistically representative of the typical usage scenarios; otherwise, profile-guided feedback has the potential to harm the overall performance of the final build instead of improving it." PGO is also less able to make dangerous optimizations compared to a JIT compiler. One good example of said optimization is the removal of null checks by java's jit: http://aria.cs.vt.edu/refs/docs/kawahito-asplos00.pdf. The jit can try the optimization at runtime, and if it encounters an error condition due to the removal it can roll back the optimization. This all happens with your program seemingly running as it normally would. Trying to apply said optimization with PGO would introduce bugs into your code.

  131. Everybody here misses the point by Anonymous Coward · · Score: 0
    Mid-Level HFT developer here posting as AC.

    The execution of C/C++ is faster than Java almost always. The development time of Java is faster than C/C++ almost always.

    HFT is now evolving. It's no longer about microseconds but it's more about smarter algorithms. Instead of making 1 penny on a hundred million trades per hour, it's about making $1.00 per million trades per hour. Coding an algorithm sitting next to the Math Ph.D. who came up with it is more important to get it out to market in hours rather than days. You only have a small time period until your algorithm is discovered and opposing HFT machines can re-code their systems to guard against it. Sure, Java will use tons more memory but buying 1TB of ECC RAM is pocket change for these HFT shops. The code will execute slightly slower, but these shops can now deploy their own custom algorithms, going from concept to code to production in a matter of hours. It's much harder to do that with C/C++ because the code is so verbose and it simply takes longer to write equivalent code. In addition, all of the good low level C/C++ devs are paid mid 6-digits or better ($400-600k). It's cheaper and easier to get an expert level Java guy from the internal IT dept for $150k and sit him between an algorithms guy and a trader on the desk than trying to lure a good C++ guy from another shop and dealing with the slimy recruiters and the fraud candidates. You also have the JVM benefits (memory management, type safety,etc.)

    Lastly, everybody here is missing the point talking about Java performance. This isn't your stereotypical enterprise data center running a line-of-business app to process invoices. These guys lay out hundreds of millions of dollars just for their hardware/infrastructure budget. Most of these HFT shops have their own custom JVM implementations, made for pauseless GC in low-latency situations along with their own customized Linux kernels or hardware-assisted JVMs. The better shops have their own custom networking stack and protocols. The best of the best run on their own hardware that was designed with customized CPUs for their servers. The future is using these custom fabs to produce RISC-based chips with the customized JVM integrated onto a chip in the form of an ASIC. Throw in gigantic L1 and L2 CPU caches so the instruction code itself is always executed on the chip itself. It's not something commercially viable and has failed in the past, but for a very specific market (HFT for example) you can make Java code scream. Yes, with enough money you can make an ultra-optimized Java implementation run faster than stock C/C++. Source: my career in finance

  132. Re:Troll much, slashdot? by satuon · · Score: 1

    Yes, but Java programmers would never have this idea, unless they were former C or C++ programmers. They think in terms of objects, not in terms of byte buffers.

    I've heard that often Java programs run slow, because there are allocations inside loops, when the same variable can be reused instead. That's because Java programmers are taught not to think about performance.

  133. How to do High Perfomance Java by kiwipom · · Score: 0

    To all the posters here who seem to have no real idea about Java http://martinfowler.com/articles/lmax.html I work in the City of London and although it is only a recent development many low latency systems are being written in Java, due to the faster time to market, the G1 GC and deterministic garbage collectors. You may be interested to know that the world's largest investment banks have most of their trading, risk and flow systems in Java so all these comments about Java being unstable, crap or slow just aren't true.

    --
    Dum spiro spero
  134. Re:Troll much, slashdot? by mark-t · · Score: 1

    The big difference, however. is that the JVM can do escape analysis at runtime... and can possibly realize that further optimize is possible.

  135. here we go again. by Anonymous Coward · · Score: 0

    I've written trading systems in Java because management insisted. Every experienced trading systems developer screamed NO.
    I wouldn't recommend it.

    It turned out that because a method is only JIT compiled after 10000 calls, we had to put 10000 orders through our system to "warm it up" every morning to get decent performance.
    Kind-of-like a valve amplifier.

    This is the kind of sh*t you have to resort to when you try to write trading apps in Java.

    Avoid.