raw speed doesn't have to be your only argument. finding a "realistic to your environment" benchmark between a compiled to machine code language and a JVM language is going to be tough, if even possible, due to the fact they are different styles of coding with very different libraries available. but it really depends on what the objectve c code is doing. if your c code is doing a lot of floating point calculations, your going to find that the jvm and c are pretty much on par with each other. where the performance is usually gained and lost is the design of the code that handles your loops, choosing the best type of arrays or collections for the situations, having an efficient data model with well indexed queries, etc.
take the system im working on now. there was an import process that previously took 4 hours to complete. i looked at the code and rewrote about 60 lines of code in a search/math routine and it now runs in 20 seconds. and the only reason it takes that long is im not allowed to reindex the database tables yet. hell years ago i increased the performance of a bank transaction system 5 fold by simply putting a new network card in it. everyone at the company (programmers included) were so focused on blaming java and "we should have never written this in java" for the system being slow that no one noticed that the network card was an old 100 meg card that had been pegged at 100% for as long as the log files went back. put 2 1 gigabit cards in it and that system screamed. and you don't want to know how many times ive increased the performance of a system by simply putting a new patch cord on the server. if you are looking for something to hang your credibility on, i would not hang it on the number of cpu cycles a specific language takes to add 2 + 2, instead, your skills as a software designer and programmer to take this existing system and replace it with a more efficient, easer, cleaner, and cheaper system to maintain and when your proposing it, remember, the check writers love the words FASTER, and CHEAPER so if you can come up with a proposal that simplifies the system into one enterprise java system that allows you to make changes to it 50% faster (therefor 50% cheaper) because you dont have to deal with C, well that will perk up some ears. On Thu, Dec 1, 2011 at 6:04 AM, Ricky Clarkson <[email protected]>wrote: > ** > I imagine that implementations of malloc/free exist or could be written > that preallocate. Thus this advantage can be achieved in C. > ------------------------------ > *From: * Kevin Wright <[email protected]> > *Sender: * [email protected] > *Date: *Thu, 1 Dec 2011 11:46:34 +0000 > *To: *<[email protected]> > *ReplyTo: * [email protected] > *Subject: *Re: [The Java Posse] Non biased performance comparison between > Java and Objective-C on GNUStep > > Actually, one of the main performance benefits Java has is pre-allocating > memory. > > C/C++/etc will often grab their (non-stack) memory on demand via > malloc/free, which is what default invocations of new and delete will > actually do behind the scenes. > Java grabs a big lump up front, "allocation" is then reduced to moving a > pointer up and down this pre-allocated heap space. > > malloc is slow, sometimes very slow, it all depends on your OS, virtual > memory, paging, etc, etc. > Moving a pointer is very very fast. > > Other JVM optimisations aside, this one difference alone can make Java > programs significantly faster that C/C++/Obj-C equivalents. > > > > On 1 December 2011 11:35, Carl Jokl <[email protected]> wrote: > >> This is not any kind of flame bait thread. >> >> I am hoping to get some unbiased information on the relative >> performance difference between Java and Objective-C. >> >> More specifically using up to date versions of the Java 6 JRE and >> using an up to date GNUStep implementation of Objective-C both running >> on Linux. >> >> I can find quite a few articles with people comparing Java vs C++ but >> I suppose Objective-C is more niche and tends not to be used in >> comparisons. >> >> I know that the opinion still prevails in many circles that Java is >> slower and/or significantly slower than code written in C/C++. There >> have been articles more recently stating that Java was capable of >> outperforming C++ these days. >> >> I am cautious with benchmarks because obviously if someone is trying >> to prove a point, that person can be selective about using benchmarks >> which support their case. >> >> I know for example that Java has performance limits doing lots of >> heavy floating point operations or trigonometry due to not using >> native acceleration where it would cause the values to be less >> accurate than required by the specifications (Though I believe this >> was being addressed). >> >> That used case may only apply to applications that use a lot of >> floating point calculations. Many business web based or enterprise >> applications may do very little floating point number crunching. >> >> For the sake of context I am in a company that has a system where Java >> is used with Servlets to provide a web front end to a system the core >> of which is written in Objective-C running on GNUStep. >> >> Considering the dates in some of the Java source I know the system >> must have existed at least as long ago as the year 2000. >> Back then the versions of Java would have been a lot slower. Java 6 >> included a big performance increase. It would have made sense back >> then to argue that the Objective-C code was going to probably perform >> better than Java. Now I don't think the difference would be as big. It >> would be within my margin of error that Java may outperform Objective- >> C due to compile time optimisation that can be done in Java that >> cannot be done in Objective-C that is more geared towards dynamic, >> runtime behaviour. In that case I would expect C++ to be faster than >> Objective-C generally speaking. >> >> I am hoping to get some feedback from the community to sanitise my >> assumptions here. >> >> I don't want to end up looking like an idiot if Objective-C >> significantly outperforms Java. >> >> The JNI overhead of having Java talk to Objective-C could cancel out >> or more than cancel out any performance gains in Objective-C if the >> difference is only slight. This depends also whether the cross >> communication comprises of many small JNI calls vs few calls that do a >> lot of processing before the call returns. >> >> Any performance information / experience would be helpful. >> >> -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > -- You want it fast, cheap, or right. Pick two!! -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
