Click here to Skip to main content
15,912,756 members

Survey Results

Code Optimization   [Edit]

Survey period: 12 Mar 2001 to 18 Mar 2001

Is code that just works good enough for you? Or are you someone that strives to make it work well. (contributed by James R. Twine)

OptionVotes% 
I do the research, and make the whole thing as fast/efficient as possible.14025.97
I try to optimize a few critical areas here and there.33161.41
If it works, it works. That is good enough for me.325.94
Works well? You should be lucky the damn thing launches!213.90
Optimization does not matter these days.152.78



 
GeneralRe: Pathetic Java code-->crawls to snail's speed Pin
James R. Twine17-Mar-01 11:37
James R. Twine17-Mar-01 11:37 
GeneralRe: Pathetic Java code-->crawls to snail's speed Pin
David Cunningham17-Mar-01 15:22
cofounderDavid Cunningham17-Mar-01 15:22 
GeneralRe: Pathetic Java code-->crawls to snail's speed Pin
James R. Twine18-Mar-01 15:48
James R. Twine18-Mar-01 15:48 
GeneralRe: Pathetic Java code-->crawls to snail's speed Pin
15-Mar-01 10:52
suss15-Mar-01 10:52 
GeneralRe: Pathetic Java code-->crawls to snail's speed Pin
James R. Twine16-Mar-01 11:10
James R. Twine16-Mar-01 11:10 
GeneralRe: Pathetic Java code-->crawls to snail's speed Pin
CodeGuy17-Mar-01 9:06
CodeGuy17-Mar-01 9:06 
GeneralRe: Pathetic Java code-->crawls to snail's speed Pin
James R. Twine17-Mar-01 11:31
James R. Twine17-Mar-01 11:31 
GeneralRe: Pathetic Java code-->crawls to snail's speed Pin
20-Mar-01 6:58
suss20-Mar-01 6:58 
>> I really find this sort of post pathetic. Knee jerk analysis.
> Knee jerk reactions are from those that are not trained well. Not me. Smile | :)
Right. How much Java training do you have? I wouldn't feel qualified to comment on Smalltalk since
I don't use it regularly. How much do you use Java?

>> I will not claim that Java is as fast as C++ for all cases. For some it is a bit faster,
>> others a bit slower. Even when comparing decent Java to decent C++ code.

> Which cases show Java to be faster than C++? I am sure that in order to back up such a
> statement, you would be willing to post links to examples, code, etc. Right?

A coworker had created a simple test of C++ IO and std::map performance to test expected performance
for an update to some code in one of our products. It read in a text file of '0' padded ints and created
a map of these as wstrings to their integer values. Then some random lookups and deletes, adding the
deleted values to a list. This was actually very similar to something that modeled what the final code
would do.

Since I have been after the folks here to look at Java more closely, I also implemented ith same in it.
The results on a 198M PIII 600mHz with 400K elements were:

VC++ 6.0 sp4 Java 1.3 (Sun)
read And create Map 247.3 sec (yes 247) 4.23 sec

Empty loop creating 3.776 sec .4 sec
key

lookup, add and remove 8.141 sec 2.073 sec

We changed STL implementations and brought the VC times down to 7.03, 2.123 and 5.348 respectively,
but Java still performed better in this test. I do not like Micro-Benchmarks and am only posting this to
confirm that for SOME tasks, Java can outperform C++.

I also remeber a CN2 benchmark that had been on the web showing similar results. I cannot find it at
the moment. I will look on some of my home machines since I think I played with it a couple years back.

>> Overall, it probably loses by a little bit when looking in real world data.
> Try a LOT. Smile | :)

I'm sure you would be willing to post links, right?

>> it is only a tool to create other tools.
> Good point! Hence my post. Too many people use Java for processing intensive,
> or performance critical applications. To do such is a bad idea.

Even here the difference in performance is closing. But often C++ will be the better choice.

> Some Java SDKs *still* have disclaimers in them about not using them for mission-critical applications.

The lawyers don't want a failure of a VM in a reactor to put them at risk. Based on the way VC messes up
code with optimizations enabled, they should also have a disclaimer

>> Java does allow me to concentrate on what I am trying to do and get it done.

> I would have to disagree there: Java helps developers to NOT concentrate on what they are
> trying to do. Why? Because it reduces the responsibility placed on the developer. They do
> not have to concentrate on "delete"ing "new"ed memory, they can just fly around their code,
> using Java's "new" with no concern for what the implications are. God forbid these "developers"
> start using C++ with a broken understanding of what "new" is, and how to use and NOT use it.

Is the purpose of your program memory management? NO. I rarely WANT to worry about that. Not
having to worry about the "implications" is a blessing. And as far as having a "broken" understanding
of what new is, Java just has a different one. They are different languages after all.

> > I have spent too much time on projects fixing memory and COM interface leaks
>> not to appreciate some of the advantages of Java.
> Then you should also appreciate what Java and VB can do to the development community at large.
> We end up "dumbing-down" software development. Dumber developers doing stupid things like
> leaking resources.

Is this real?? Any language can be used stupidly. I once worked tech support for a comipler vendor
and had to explain to a user with 10+ years experience that you had to call delete when you new'ed
something.
Lisp has a GC. Are all Lisp programmers stupid? Physists now use calculatorsand computers instead
of doing calculations in their heads. Are they now dumber because of it? Have a tool and using it
lets you concentrate on other skills. Like good design.

>> [...] go into making my code selectively faster [...]
>Always decent bait.
And this means???

>> Would I use Java for everything. NO! But then I also use more than a screwdriver when
>> working around the house. If you refuse to look at other tools, everything gets screwed.

> Again, something that matches my original "pathetic", "knee jerk" post. "Because dumbasses
> out there fall into the "Java trap'", and start thinking that Java is the solution to everything.

And others refuse to accept that Java has a place. Both sides are wrong.

> Take a look around at how many companies have embraced Java as a serious development
> platform, and maybe you will understand my post a bit more.

I know plenty of people in many companies working in Java. So I still don't understand the post.


>Peace! -=- James.
Best Wishes also.

Otis
GeneralRe: Pathetic Java code-->crawls to snail's speed Pin
James R. Twine21-Mar-01 3:39
James R. Twine21-Mar-01 3:39 
GeneralRe: Pathetic Java code-->crawls to snail's speed Pin
23-Mar-01 7:44
suss23-Mar-01 7:44 
Generalnot many programs Pin
12-Mar-01 4:51
suss12-Mar-01 4:51 
GeneralRe: not many programs Pin
Christian Graus12-Mar-01 12:25
protectorChristian Graus12-Mar-01 12:25 
GeneralLittle modification of third option Pin
Slavo Furman12-Mar-01 2:36
Slavo Furman12-Mar-01 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.