Comment On Java is Slow!

Pete and his manager Dick were ACME Corporation's version of The Odd Couple. They both shared in the support and maintenance of a monstrous in-house spawned order processing / network monitoring / invoice printing / slashy / slash / slash system written in Visual C++. However, while Pete kept up in the latest technology trends and was always on the lookout for new solutions to old problems, Dick was a very conservative manager with twenty-five company years under his belt. To Dick, "change" was only a Good Thing when it added up to 65¢, which was the exact amount required to buy a ginger ale from the soda machine. What kept Pete and Dick from being a perfect couple was that Dick was Pete's supervisor and often times, he got his way. [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6Next »

Re: Java is Slow!

2009-05-12 13:11 • by SomeCoder (unregistered)
261214 in reply to 261175
BoomWav:
In a enterprise environment, maintainability is WAY WAY more important than performance most of the time.


Which is why computers get faster and yet when you get a new machine, they run as slow or slower as your old machine. The new software eats up all of the new hardware's capability.

While I would agree that you have to consider development time vs performance, I see developers these days choosing development time far too often when performance is still needed. Saying that "Well the user has a gig of RAM/Fast CPU/quick hard drive/etc. so I can be lazy" is becoming acceptable and that is truly TRWTF.

That said, I would never agree with Dick in this particular situation :)

Re: Java is Slow!

2009-05-12 13:13 • by Dennis (unregistered)
261215 in reply to 261206
Dennis:
Procedural:
Is Alex writing or rewriting everything these days ? I really enjoyed the writing on this one. The images (loved the quip about change), the tone and rhythm, this was stellar (minor quibble: "As the years past by" -> "As the years passed by")


TRWTF is that many of the articles have this kind of "typo".


Here are more from this one [green=additions, red=deletions]:

"...anger to one of the lead developers in the other group..."

"...Dick had of predictably blamed Java..."

Re: Java is Slow!

2009-05-12 13:15 • by Kef Schecter (unregistered)
261216 in reply to 261193
d3matt:
kastein:
I definitely agree about the writing BTW, this one was awesome with the only exception being the minor "past" instead of "passed" homonym swap, as noted above.

You mean homophone... http://en.wikipedia.org/wiki/Homonym (I used to call them homonyms as well)


Homophones are homonyms. It's just a more specific kind of homonym. See the "variant definitions" section of that Wikipedia article. For instance, the first two definitions Merriam-Webster gives for "homonym" are "homophone" and "homograph" -- it's probably noteworthy that these appear *before* the definition Wikipedia gives.

Re: Java is Slow!

2009-05-12 13:46 • by greatfog (unregistered)
261218 in reply to 261201
Jay:
Java 6 so fast that it can execute an infinite loop in 12 seconds.


Now, just a minute, sonny. Is that an aleph-null-iterations infinite loop or an aleph-one-iterations infinite loop?

Re: Java is Slow!

2009-05-12 13:47 • by Franz Kafka (unregistered)
261219 in reply to 261186
Anon:
Fedaykin:
What "special servers" and "special software" do you think is required to run Java?


Well, the Java Runtime Environment and Java Virtual Machine come to mind as special software. C++ applications don't require either of those to run.

The reality is that Java remains to this day far slower than an application that gets compiled to native code. Whether or not that matters depends on the specific case - generally the additional memory usage and startup time don't matter in long-running environments where memory is plentiful.

But suggesting that Java is lighter weight or faster than a well-written native application is ludicrous at best.


C++ apps have a runtime too, but so what? The jdk is easily found and installed. The special server thing has been dropped, I see - good thing too, since java servers are just like other servers.

Java is absolutely fasater than C++ when you consider dev time.

Re: Java is Slow!

2009-05-12 13:52 • by Franz Kafka (unregistered)
261221 in reply to 261214
SomeCoder:
I see developers these days choosing development time far too often when performance is still needed. Saying that "Well the user has a gig of RAM/Fast CPU/quick hard drive/etc. so I can be lazy" is becoming acceptable and that is truly TRWTF.

That said, I would never agree with Dick in this particular situation :)


If I can write a system that works quickly and use a ton of RAM doing it, that just may be the thing to do. Writing the prototype app quickly and iterating the design a bit before making the code tight is my preferred approach, although the apps are usually not that wasteful.

Re: Java is Slow!

2009-05-12 14:09 • by kastein
261223 in reply to 261212
snoofle:
wee:
TRWTF is nobody proofreads shit.

Sorry, I gotta ask.... what braille-literate person would want that job?
if it's bumpy enough to be read as braille, you need more fiber.

... anyways...

wow, the language zealots are out in full force! can't we all just pick on PHP and VB and be happy?

Re: Java is Slow!

2009-05-12 14:09 • by insquinormalc (unregistered)
261224 in reply to 261198
You think Java code is "ugly" and the "language semantics are a bitch", but would code in C#? Perhaps there's some other language called C# out there that I'm not aware of, but the one I use looks 95% the same as Java.

Re: Java is Slow!

2009-05-12 14:15 • by BoomWav (unregistered)
261227 in reply to 261214
SomeCoder:
BoomWav:
In a enterprise environment, maintainability is WAY WAY more important than performance most of the time.


Which is why computers get faster and yet when you get a new machine, they run as slow or slower as your old machine. The new software eats up all of the new hardware's capability.

While I would agree that you have to consider development time vs performance, I see developers these days choosing development time far too often when performance is still needed. Saying that "Well the user has a gig of RAM/Fast CPU/quick hard drive/etc. so I can be lazy" is becoming acceptable and that is truly TRWTF.

That said, I would never agree with Dick in this particular situation :)


It's important to take the right tool for the job. There's no language that is the best for all jobs. It's not like that and it never will.

At this time, from my POV, it's pretty clear.

If portability is important for you, I'd go with Java, everytime. It's the main strenght of Java, there's no doubt into that. Java is easy enough to maintain too. It a bit hard to find good people however since there's a broad range of different libraries that do the same things making experience difficult to acquire.

C++ is the expert language. It's good for really dedicated application. You have so much freedom into everything that it's the easiest way to make your tool the best for its job. You can have no tradeoff at all. Put everything in performance or memory management for the maximum boost. It's difficult to maintain however and the deadlines are always too close for everybody. Ask the game developpers.

C# with the .NET framework is really appealing to a lot of people. You can go web-based with the same code with ASP.NET. The .NET framework is really solid too and well known. If you hire someone with C# experience, you know he will do the job since .NET is universal. It's also faster than java and is better supported.

I might be biaised however but it's my view on things.

Re: Java is Slow!

2009-05-12 14:18 • by BoomWav (unregistered)
261229 in reply to 261224
insquinormalc:
You think Java code is "ugly" and the "language semantics are a bitch", but would code in C#? Perhaps there's some other language called C# out there that I'm not aware of, but the one I use looks 95% the same as Java.


Yep, the code is really similar. Some syntax is better in C# however. The whole foreach() for example. Do not forget that the framework is also better in C#. Did you ever try to work with dates in Java? You'll want to kill yourself the first week you try to get something working. I exaggerate but so do you!

Re: Java is Slow!

2009-05-12 14:20 • by Spectre
The installer pictured on the screenshot was actually awfully slow on one computer I had to install JRE on. It kept on trucking for 15 minutes or so. So I thought it was generally slow, and then it ran in under a minute on an another PC.

Re: Java is Slow!

2009-05-12 14:24 • by Jeremy (unregistered)
They didn't get the contract, because Peter was lying out the kazoo and Dick was oblivious to what they were selling. If Peter was the good little programmer he makes himself out to be, why didn't he leave year after year?

Re: Java is Slow!

2009-05-12 14:25 • by SomeCoder (unregistered)
261232 in reply to 261221
Franz Kafka:
SomeCoder:
I see developers these days choosing development time far too often when performance is still needed. Saying that "Well the user has a gig of RAM/Fast CPU/quick hard drive/etc. so I can be lazy" is becoming acceptable and that is truly TRWTF.

That said, I would never agree with Dick in this particular situation :)


If I can write a system that works quickly and use a ton of RAM doing it, that just may be the thing to do. Writing the prototype app quickly and iterating the design a bit before making the code tight is my preferred approach, although the apps are usually not that wasteful.


I guess it depends on what the system is supposed to do. If you are writing something that is to run on a Windows machine and mostly likely have to share resources with other programs being open at the same time, I'd rather you work a little slower and use the RAM more efficiently so I can still have some left over for other programs that I may be running at the same time.

On the other hand, if you are writing a system that is going to run in Unix and needs to crunch a lot of data very quickly, I see no reason to try and be efficient with memory.

I was generalizing above (and in my previous post as well), and you probably were too, but my point still stands: I see lots of lazy developers these days and when my brand new, top of the line computer grinds to a halt because of it, that is irritating and I think it should be unacceptable.

I would definitely agree with you that iterating over the code/design is a good method to use.

Re: Java is Slow!

2009-05-12 14:26 • by C4I_Officer
261234 in reply to 261186
Anon:
The reality is that Java remains to this day far slower than an application that gets compiled to native code. Whether or not that matters depends on the specific case - generally the additional memory usage and startup time don't matter in long-running environments where memory is plentiful.



The Java is Faster than C++ and C++ Sucks Unbiased Benchmark.

Have fun ;-)

Re: Java is Slow!

2009-05-12 14:29 • by campkev
261235 in reply to 261216
Kef Schecter:
d3matt:
kastein:
I definitely agree about the writing BTW, this one was awesome with the only exception being the minor "past" instead of "passed" homonym swap, as noted above.

You mean homophone... http://en.wikipedia.org/wiki/Homonym (I used to call them homonyms as well)


Homophones are homonyms. It's just a more specific kind of homonym. See the "variant definitions" section of that Wikipedia article. For instance, the first two definitions Merriam-Webster gives for "homonym" are "homophone" and "homograph" -- it's probably noteworthy that these appear *before* the definition Wikipedia gives.


This argument is making me homophobic

Re: Java is Slow!

2009-05-12 14:34 • by Technical Thug
A man had a problem. He said, "I know I'll fix it using Java!" Then all his co-workers took him out back and beat him to death.

Re: Java is Slow!

2009-05-12 14:36 • by insquinormalc (unregistered)
261238 in reply to 261229
"Some syntax is better in C# however. The whole foreach() for example."

Ok.

C#:

foreach (Thing t in my_list) {
// do some stuff
}

Java:

for (Thing t : my_list) {
// do some stuff
}


I don't see much of a difference. I suppose if you enjoy typing "each" and "in", the C# example is "better", and if you enjoy typing colons, the Java example is better, but it's pretty much, um, the same.

I have *never* met a date library I liked.

Re: Java is Slow!

2009-05-12 14:39 • by lol (unregistered)
TRWTF is letting the customer establish language platform as a functional requirement.

Re: Java is Slow!

2009-05-12 14:39 • by C4I_Officer
261240 in reply to 261238
insquinormalc:
"Some syntax is better in C# however. The whole foreach() for example."

Ok.

C#:

foreach (Thing t in my_list) {
// do some stuff
}

Java:

for (Thing t : my_list) {
// do some stuff
}


Well, not everyone is aware of Java's enhanced for loops since...uhmm...version 1.5 or so. Some people seem to conveniently forget about Java's JIT and Hotspot optimizations, too.

Re: Java is Slow!

2009-05-12 14:40 • by Zer0 (unregistered)
261241 in reply to 261213
snookerdoodle:
I once interviewed for a project that would use my experience in both C++ and Java: they wanted to convert a desktop client application from Java to C++ because the application had memory leaks and they heard you had more control over memory allocation in C++.

I called the headhunter as soon as I walked out and told him I didn't think I'd be a good fit there.


Hahahaha. That was worth reading through all the crap about managed code being so much slower than native code. Anyone see Quake ported over in C#?

Re: Java is Slow!

2009-05-12 14:48 • by Franz Kafka (unregistered)
261244 in reply to 261229
BoomWav:
insquinormalc:
You think Java code is "ugly" and the "language semantics are a bitch", but would code in C#? Perhaps there's some other language called C# out there that I'm not aware of, but the one I use looks 95% the same as Java.


Yep, the code is really similar. Some syntax is better in C# however. The whole foreach() for example. Do not forget that the framework is also better in C#. Did you ever try to work with dates in Java? You'll want to kill yourself the first week you try to get something working. I exaggerate but so do you!


Java after 1.5 has for(i:iterable), which is the same as foreach. Dates work fine - use Calendar and the DateFormatter classes.

Re: Java is Slow!

2009-05-12 14:55 • by kastein
261245 in reply to 261238
insquinormalc:
"Some syntax is better in C# however. The whole foreach() for example."

Ok.

C#:

foreach (Thing t in my_list) {
// do some stuff
}

Java:

for (Thing t : my_list) {
// do some stuff
}


I don't see much of a difference. I suppose if you enjoy typing "each" and "in", the C# example is "better", and if you enjoy typing colons, the Java example is better, but it's pretty much, um, the same.

I have *never* met a date library I liked.


// java.h
// Purpose: make stupid java stuff work right in a real langauge

#ifndef JAVA_H
#define JAVVA_H

#define : in

#endif

Re: Java is Slow!

2009-05-12 14:56 • by RBoy (unregistered)
First!

(Comment was written in Java, running on a nulla machine, so it may be slow to post)

Re: Java is Slow!

2009-05-12 15:01 • by SomeCoder (unregistered)
261247 in reply to 261241
Zer0:
snookerdoodle:
I once interviewed for a project that would use my experience in both C++ and Java: they wanted to convert a desktop client application from Java to C++ because the application had memory leaks and they heard you had more control over memory allocation in C++.

I called the headhunter as soon as I walked out and told him I didn't think I'd be a good fit there.


Hahahaha. That was worth reading through all the crap about managed code being so much slower than native code. Anyone see Quake ported over in C#?



I've seen the Quake 2 port from C to C++.NET (CLR). It was quite a bit slower but in practice it was at least playable. The framerate suffered more than I would have liked for a video game though

Re: Java is Slow!

2009-05-12 15:10 • by xtremezone
261248 in reply to 261200
Jay:
Well, last I checked C++ apps require that you have numerous libraries installed. A decent install program for a Java app will have to install the JVM, just like a decent install program for a C++ app will have to install a bunch of libraries. I don't see that as a truly qualitative difference.
A library is just reused code and that concept still exists for Java on top of the JVM. Java programs need to be run inside of the JVM, which is a different concept all together, and qualifies as "special software" IMHO.
Jay:
I'm surprised that Sun hasn't made it easier to install the JVM -- at least as of when I was last working with desktop apps, maybe they've done it better by now. (These days I'm on web apps, where I don't ask the user to install anything besides a browser.) But you write your own installer for it once and re-use it for every app and it doesn't really matter.
In college (two years ago), one of the things that confused the Hell out of me was how I could be downloading version 5 of the JDK or JRE if the most recent version was 1.5... WTF?! I didn't figure out WTF they were doing until a year outside of college...
amischiefr:
Let's start with "The language semantics are a bitch." How so? You don't like "public int x = 1"? Is that terribly difficult for you to understand? Maybe since it doesn't have a * or an & in there you can't comprehend it. <shrug /> The semantics are some of the easiest to understand (and yes I program in ANSI C, C++, ASP .NET and VB .NET, and Java), and coincidentally they are VERY VERY similar to C#, which I believe you recommend :)
Sure, show the C-like syntax to try to make it seem the same, but any C/C++ coder that's moved on to Java will quickly point out the frustrating semantics. For example, immutable strings.
// Java

char c;
String name = "john";
// Let's uppercase the first letter of name.
c = char.toUpperCase(name.charAt(0));
name = new String(c) + name.substring(1);

// C++

std::string name = "john";
// Let's uppercase the first letter of name.
name[0] = toupper(name[0]);

amischiefr:
"The code is ugly" Alright now you're just being stupid. Java code is very easily readable and is VERY straight forward. ESPECIALLY compared to C and C++. What don't you understand about:

public int getX() {
return x;
}

Are there just not enough of those * and & that you love so much in C++? if it was:

return &x;

Would it be that much easier to read, oh and "sexier"?
Again, you're using C-like syntax to make it appear the same, when in reality there are very different semantics in Java. One of the things I find extremely ugly about Java code is that there are no operator overloads (except for those provided as part of the language, like operator+ for String) which results in lots of verbose, nested method calls with really long lines (or that many more lines if you split it up).
// Java

MyNumberClass number = new MyNumberClass(5);
MyNumberClass number2 = new MyNumberClass(6);
number = number.divideBy(number2.multiplyBy(number.add(number2))).subtract(number2);

// C++

MyNumberClass number(5);
MyNumberClass number2(6);
number = (number / (number2 * (number + number2))) - number2;

The pointer and reference operators in C/C++ don't make the code easier to read, but they give the programmer more control over the program and let him or her do exactly what they want. It isn't n00b friendly, but then n00bs shouldn't be entrusted with writing important software anyway. Java doesn't make the code maintainable automatically. It just limits what the programmer can do through its language semantics with the belief that it will lead to fewer errors. We've seen just as many WTFs on this site for Java, if not more, than we have for C or C++. :P The real truth is that not everybody can program well and creating "dummy-proof" languages to encourage them to try is TRWTF. :D
amischiefr:
"...in my experience it always performs poorly ... near unusable)." You need more experience. I don't have too much to say except that you are completely ignorant and need to experience more in life.
Performance is not Java's strength and probably never will be. Anybody arguing that is insane. It can perform OK for simple tasks, but workstations (particularly for developers like ourselves) are always being pushed to the limits (I probably have something like 60+ tabs open in Firefox right now). Java doesn't perform well enough for me to enjoy using it. On top of that, in my experience, .NET performs better (although honestly I've noticed that ASP.NET is also very slow, at least how "we're" using it, but that could just be because we're doing it wrong).
amischiefr:
I am not saying that Java is the best. Hell I would rather be programming in C# .NET myself. But I hate senseless Java bashers that have no idea what the fuck they are talking about.
I'm not trying to come across as a senseless Java basher. I recognize that Java has its niche and can be used effectively. I just haven't really found it useful yet, and I've tried many times (both in college and out).
Fedaykin:
The syntax and semantics of Java are, by design, very similar to C and C++. Any competent programmer that writes Java can pick up a C or C++ app and be able to understand it pretty easily (and visa versa).

So please, enlighten me as to what's so radically different about Java to make it's semantics "a bitch".
The syntax of Java is very similar to C and C++ because it's a C-like language. The semantics, however, are VERY different. If you don't understand semantics, implicitly passing arguments by reference is an example of a semantic with consequences.

Another thing that bothers me about Java is its lack of constants...

The first language I learned was C++ and I've picked up C along the way. And I prefer them to anything else I've used. Although D sounds like a great compromise between C-like and high-level, it won't really be useful until it gets a powerful standard library and it really catches on, which could take a few more years.
Franz Kafka:
Java is absolutely fasater than C++ when you consider dev time.

How many programs do you know of that spend more time in development then being executed? Probably not that many. While lots of time can be spent developing software, it is usually run much longer and by many more people (thousands, hundreds of thousands, millions, etc.). End users want a user-friendly experience and part of that is responsiveness and the ability to play nice with the rest of the system.

Re: Java is Slow!

2009-05-12 15:10 • by SNF (unregistered)
261249 in reply to 261210
Fine, fine, I'll do it.

Ok, let's see.. s... h... i... t... end of a sentence, period, no initial capital...

It's fine, everyone! Now get back to work.

Re: Java is Slow!

2009-05-12 15:11 • by Procedural (unregistered)
261250 in reply to 261215
Dennis:
Dennis:
Procedural:
Is Alex writing or rewriting everything these days ? I really enjoyed the writing on this one. The images (loved the quip about change), the tone and rhythm, this was stellar (minor quibble: "As the years past by" -> "As the years passed by")


TRWTF is that many of the articles have this kind of "typo".


Here are more from this one [green=additions, red=deletions]:

"...anger to one of the lead developers in the other group..."

"...Dick had of predictably blamed Java..."


Right; although my point is that, typos and such notwithstanding, Alex is turning, post by post, into a truly accomplished writer here.

Re: Java is Slow!

2009-05-12 15:13 • by Capt. Obvious (unregistered)
261251 in reply to 261218
greatfog:
Now, just a minute, sonny. Is that an aleph-null-iterations infinite loop or an aleph-one-iterations infinite loop?
Well, depending on your view of the continuim hypothesis, aleph-one may lack an understandable defintion. Just ask if it was aleph-null iterations or beth-null iterations next time.

Re: Java is Slow!

2009-05-12 15:18 • by justsomedude (unregistered)
261252 in reply to 261218
greatfog:
Jay:
Java 6 so fast that it can execute an infinite loop in 12 seconds.


Now, just a minute, sonny. Is that an aleph-null-iterations infinite loop or an aleph-one-iterations infinite loop?


Omega baby, we're talking THE INFINITE.

*shout out to rudy rucker*

Re: Java is Slow!

2009-05-12 15:18 • by justsomedude (unregistered)
261253 in reply to 261218
greatfog:
Jay:
Java 6 so fast that it can execute an infinite loop in 12 seconds.


Now, just a minute, sonny. Is that an aleph-null-iterations infinite loop or an aleph-one-iterations infinite loop?


Omega baby, we're talking THE INFINITE.

*shout out to rudy rucker*

Re: Java is Slow!

2009-05-12 15:23 • by Milligan (unregistered)
261254 in reply to 261199
[quote user="snoofle"
I was always under the impression that a company cafeteria/snack machine was there to keep you from going out and taking longer to get back to your desk; not to make a profit.
[/quote]
That's usually true, until the beancounters take over.

Re: Java is Slow!

2009-05-12 15:24 • by xtremezone
261255 in reply to 261224
insquinormalc:
You think Java code is "ugly" and the "language semantics are a bitch", but would code in C#? Perhaps there's some other language called C# out there that I'm not aware of, but the one I use looks 95% the same as Java.
C# supports a number of syntactic sugars that make it better than Java in many ways. For example, properties and overloaded operators. The whole language is a much improved Java. And .NET is much nicer to work with, IMHO, than Java's standard library. I still have my gripes with C# though. It isn't perfect.

Re: Java is Slow!

2009-05-12 15:32 • by Capt. Obvious (unregistered)
261256 in reply to 261162
Zapp Brannigan:
Oh yeah, Java is slow compared to C++ as long as you don't account for the development time.
I guess it depends on how many people use your application. As Steve Jobs once told someone assigned to cut 0.1 seconds off the boot time, it was worth spending a week on because it would save hundreds of customer-lifetimes.

Or words to that effect. He's a better speaker than I am a paraphraser.

Re: Java is Slow!

2009-05-12 15:32 • by Owner (unregistered)
261257 in reply to 261238
insquinormalc:
"Some syntax is better in C# however. The whole foreach() for example."

Ok.

C#:

foreach (Thing t in my_list) {
// do some stuff
}

Java:

for (Thing t : my_list) {
// do some stuff
}


I don't see much of a difference. I suppose if you enjoy typing "each" and "in", the C# example is "better", and if you enjoy typing colons, the Java example is better, but it's pretty much, um, the same.


Ah, but can you do this:

foreach(var t in myList) { }

in java??

For example

for (MultipleComponentProfileHolder m : myList) { }

I tried to find a longer java class name but I couldn't.


Personally? C# over java any day of the week. There are just too many good things about developing in C# that java can never give you (ex. Web Applications). Yes multiplatform IS the upside to Java, but reality is unless its research or home user downloadable software, its really quite a useless requirement.

Commercial and Enterprise applications? Only if you can't afford Visual Studio + programmers :)

Agree 100% with previous post.

Re: Java is Slow!

2009-05-12 15:32 • by Gerrit (unregistered)
261258 in reply to 261238
insquinormalc:

I have *never* met a date library I liked.


Try dating humans.

Re: Java is Slow!

2009-05-12 15:33 • by zoips (unregistered)
261259 in reply to 261248
xtremezone:
In college (two years ago), one of the things that confused the Hell out of me was how I could be downloading version 5 of the JDK or JRE if the most recent version was 1.5... WTF?! I didn't figure out WTF they were doing until a year outside of college...


The naming scheme is stupid, but that's such an idiotic quibble it reflects badly on your argument.

xtremezone:

// Java

char c;
String name = "john";
// Let's uppercase the first letter of name.
c = char.toUpperCase(name.charAt(0));
name = new String(c) + name.substring(1);

// C++

std::string name = "john";
// Let's uppercase the first letter of name.
name[0] = toupper(name[0]);


I'm not sure that arguing about the immutability of strings in Java is helping you. If you want a C string, pass around a char[] array, it's the same damn thing (except, you know, it's bounds checked), or use java.lang.StringBuilder since its intended use is more closely aligned with std::string than java.lang.String is.


StringBuilder str = new StringBuilder("john")

str.setCharAt(0, Character.toUpperCase(str.charAt(0))


Yes, more verbose, goes to below which I concede.

xtremezone:

// Java

MyNumberClass number = new MyNumberClass(5);
MyNumberClass number2 = new MyNumberClass(6);
number = number.divideBy(number2.multiplyBy(number.add(number2))).subtract(number2);



That is one of the most oft leveled complaints at BigDecimal, BigInteger, and matrix libraries, I'll give you that. Operator overloading is nice.

xtremezone:

The syntax of Java is very similar to C and C++ because it's a C-like language. The semantics, however, are VERY different. If you don't understand semantics, implicitly passing arguments by reference is an example of a semantic with consequences.


I'm not sure where you would want to pass by value in Java...

xtremezone:

Another thing that bothers me about Java is its lack of constants...


Java has a final keyword. On fields it makes them readonly, on method parameters, it prevents the object from being modified. This goes to the above where, again, I'm not sure where you'd need to pass by value in Java.

Re: Java is Slow!

2009-05-12 15:35 • by EmperorOfCanada (unregistered)
My experience with C++, .net and Java has generally been that C++ is often overkill for smaller applications. But with Java and .net you reach a certain point where you are fighting with the language itself to get to where you need to go. This results in a project where you spend the last half of the project in the "90% done" phase. With C+ you begin the fight with your first line of code but generally it will be able to plod along to a final product at a predictable speed.
I suspect that Dick not only didn't like Java but also didn't like anything new in C++ if I had to guess he also was still using MFC or something. Bring things like Boost and QT to the table and C++ can actually be fun to develop in.

All that said, I use PHP most of the time now. Right tool for the job is the real rule.

P.S. I use Eclipse for most coding and am regularly reminded that Java apps are almost always twitchy apps. Please find me a multi platform, multi language IDE developed in C++ please.

Re: Java is Slow!

2009-05-12 15:36 • by benryves
261261 in reply to 261248
xtremezone:
Sure, show the C-like syntax to try to make it seem the same, but any C/C++ coder that's moved on to Java will quickly point out the frustrating semantics. For example, immutable strings.
Isn't that more a library issue than a language issue? .NET's string is also immutable, but StringBuilder acts as a mutable string:
// C#

var Name = new StringBuilder("john");
Name[0] = char.ToUpper(Name[0]);

Re: Java is Slow!

2009-05-12 15:39 • by Zer0 (unregistered)
261262 in reply to 261247
SomeCoder:
Zer0:
snookerdoodle:
I once interviewed for a project that would use my experience in both C++ and Java: they wanted to convert a desktop client application from Java to C++ because the application had memory leaks and they heard you had more control over memory allocation in C++.

I called the headhunter as soon as I walked out and told him I didn't think I'd be a good fit there.


Hahahaha. That was worth reading through all the crap about managed code being so much slower than native code. Anyone see Quake ported over in C#?



I've seen the Quake 2 port from C to C++.NET (CLR). It was quite a bit slower but in practice it was at least playable. The framerate suffered more than I would have liked for a video game though


I saw a Quake 2 port to C# (i think it was the second one now that I think about it) with an added map interface in a seperate GUI. There was a framerate drop, but not by much.

Re: Java is Slow!

2009-05-12 15:40 • by BikeHelmet
261263 in reply to 261186
Anon:
Fedaykin:
What "special servers" and "special software" do you think is required to run Java?


Well, the Java Runtime Environment and Java Virtual Machine come to mind as special software. C++ applications don't require either of those to run.

The reality is that Java remains to this day far slower than an application that gets compiled to native code. Whether or not that matters depends on the specific case - generally the additional memory usage and startup time don't matter in long-running environments where memory is plentiful.

But suggesting that Java is lighter weight or faster than a well-written native application is ludicrous at best.

http://www.excelsior-usa.com/jet.html

A fast x86 java compiler.

In my experience, the shorter dev time of java results in more time being spent creating quality code and adding new features. Higher performance algorithms are implemented, and the end result runs faster than C++ apps, without memory leaks or other bugs.

"1x to 3x slower" isn't even worth mentioning. C++ is roughly that much slower than assembly, but you'd take C++ over ASM because of the dev time alone.

And don't give me that crap about the modern compiler optimizing more than assembly can. If you write the entire program in ASM, it will be significantly faster than a C++ program would be.

It's a scale; for dev time and ease of implementing features, C++ is somewhere in the middle.

Re: Java is Slow!

2009-05-12 15:57 • by donnie (unregistered)
2 pages of comments and nobody points out that the story directly amounts to "cockblock?"

Re: Java is Slow!

2009-05-12 15:59 • by Franz Kafka (unregistered)
261265 in reply to 261248
xtremezone:
Jay:
Well, last I checked C++ apps require that you have numerous libraries installed. A decent install program for a Java app will have to install the JVM, just like a decent install program for a C++ app will have to install a bunch of libraries. I don't see that as a truly qualitative difference.
A library is just reused code and that concept still exists for Java on top of the JVM. Java programs need to be run inside of the JVM, which is a different concept all together, and qualifies as "special software" IMHO.

Who cares if it's special? Operationally, it's about the same as a library.

In college (two years ago), one of the things that confused the Hell out of me was how I could be downloading version 5 of the JDK or JRE if the most recent version was 1.5... WTF?! I didn't figure out WTF they were doing until a year outside of college...


If you can't figure our marketing driven naming, then you may not be cut out for programming.



Franz Kafka:
Java is absolutely fasater than C++ when you consider dev time.

How many programs do you know of that spend more time in development then being executed? Probably not that many. While lots of time can be spent developing software, it is usually run much longer and by many more people (thousands, hundreds of thousands, millions, etc.). End users want a user-friendly experience and part of that is responsiveness and the ability to play nice with the rest of the system.


Wrong metric, but you're a noob, so it's ok. It's cheaper to spend a bit more (50%, say) to make a java web app run well than it is to write it in C++, mainly because C++ sucks from a dev time perspective. Sure, if you're shipping to a million people, 1 second saved is a big deal, but we're talking about web apps and backend processing.

Re: Java is Slow!

2009-05-12 16:01 • by xtremezone
261266 in reply to 261261
benryves:
xtremezone:
Sure, show the C-like syntax to try to make it seem the same, but any C/C++ coder that's moved on to Java will quickly point out the frustrating semantics. For example, immutable strings.
Isn't that more a library issue than a language issue? .NET's string is also immutable, but StringBuilder acts as a mutable string:
// C#

var Name = new StringBuilder("john");
Name[0] = char.ToUpper(Name[0]);
Touche. :P Like I said, C# isn't perfect. I view StringBuilder as an efficient way to make strings from multiple sources or rules. So I think the string class should still be able to do this, albeit less efficiently (although in this case, it should be more efficient).

I like that in D (AFAIK: it's been a while since I've look into D), there is no string class at all. Between the char type and arrays as objects, everything a conventional string class can do can be accomplished with an array of characters. It's brilliant.

Re: Java is Slow!

2009-05-12 16:09 • by Havstein
After Java 1.4.2, Java got so fast they could skip Java 2,3 and 4 and go straight to Java 5. I think that's remarkable.

Re: Java is Slow!

2009-05-12 16:15 • by Zer0 (unregistered)
261268 in reply to 261266
xtremezone:
benryves:
xtremezone:
Sure, show the C-like syntax to try to make it seem the same, but any C/C++ coder that's moved on to Java will quickly point out the frustrating semantics. For example, immutable strings.
Isn't that more a library issue than a language issue? .NET's string is also immutable, but StringBuilder acts as a mutable string:
// C#

var Name = new StringBuilder("john");
Name[0] = char.ToUpper(Name[0]);
Touche. :P Like I said, C# isn't perfect. I view StringBuilder as an efficient way to make strings from multiple sources or rules. So I think the string class should still be able to do this, albeit less efficiently (although in this case, it should be more efficient).

I like that in D (AFAIK: it's been a while since I've look into D), there is no string class at all. Between the char type and arrays as objects, everything a conventional string class can do can be accomplished with an array of characters. It's brilliant.


C-strings. Blah. I think char arrays have been beaten to death, so I think that's why string classes showed up to begin with. Sounds like a step backwards. Not sure how in the world that's brilliant...

FYI, I think it was a great design decision to make strings immutable.

Re: Java is Slow!

2009-05-12 16:18 • by voyou (unregistered)
261269 in reply to 261248
xtremezone:
Sure, show the C-like syntax to try to make it seem the same, but any C/C++ coder that's moved on to Java will quickly point out the frustrating semantics. For example, immutable strings.


I don't think this is a good example; AFAIK, pretty much everyone in the C++ community now thinks making std::string mutable was a mistake, and that, if the C++ standard were being written today, there would be an immutable string class (it's much more efficient in the more common case where strings aren't mutated, especially in multithreaded applications).

You're right that Java's lack of operator overloading is annoying, as is the lack of user-defined value types. And Java's generics are a bit weak, too (though making them just syntactic sugar for casts to and from Object maintains backwards combatibility, which was probably the right trade-off to make).

(captcha: "persto," which I assume, in keeping with the theme of this comments thread, is a type for "pesto")

Re: Java is Slow!

2009-05-12 16:21 • by hoselade (unregistered)
261270 in reply to 261229
BoomWav:
...Yep, the code is really similar. Some syntax is better in C# however. The whole foreach() for example. Do not forget that the framework is also better in C#. Did you ever try to work with dates in Java?...


Since a couple of versions ago, java does have a foreach equivalent as well.

Not sure if i would agree that the framework is better just based on functionality around dates/calendar... what i find most interesting and scary at the same time is the sheer infinite number of frameworks that are out there, lot's of them are very powerful, but only few play well together...

Re: Java is Slow!

2009-05-12 16:21 • by noob (unregistered)
261271 in reply to 261239
lol:
TRWTF is letting the customer establish language platform as a functional requirement.


Why is that a WTF? Many customers want to buy the initially developed and tested source code and maintain it themselves. Almost all of the projects I've worked on have a RFQ that specifies a preferred language.

Re: Java is Slow!

2009-05-12 16:23 • by sylvic
261272 in reply to 261260
EmperorOfCanada:

P.S. I use Eclipse for most coding and am regularly reminded that Java apps are almost always twitchy apps. Please find me a multi platform, multi language IDE developed in C++ please.



emacs

Re: Java is Slow!

2009-05-12 16:27 • by Daniel (unregistered)
And yet, Java is slow.
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6Next »

Add Comment