473,378 Members | 1,564 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

java, c or c++

choice between c and c++ is pretty obvious if the program is even
moderately big.

how does java score in comparison to c++ in terms of efficiency ?
i guess java definitely has more libraries, more verbosity (for
clarity to programmers) etc etc.
The only concern is efficiency. How does java compare with C/C++ on
that ?

Sep 30 '07 #1
12 1561
>From what I've seen in its early days Java was much much slower than C+
+, however "lately" I've noticed a big speed increase in Java
programs. The way I see it, if you're building an application that
will be ran for 10 min at a time, you should stay away from java
because it'll have to recompile everything every time you run it.
However if it's a program that'll be ran for days, in terms of speed C+
+ and Java are just about the same.

What Java is still worst at is memory. It simply uses way too much
memory. But it has more libraries, as you pointed out yourself. So
weight memory vs "libraryfulness", and decided.

Anyway, that's my two cents.

Lucas

On Sep 30, 11:41 am, call_me_anything <sgiitne...@gmail.comwrote:
choice between c and c++ is pretty obvious if the program is even
moderately big.

how does java score in comparison to c++ in terms of efficiency ?
i guess java definitely has more libraries, more verbosity (for
clarity to programmers) etc etc.
The only concern is efficiency. How does java compare with C/C++ on
that ?

Sep 30 '07 #2
call_me_anything wrote:
choice between c and c++ is pretty obvious if the program is even
moderately big.
Why? Are you only concerned about speed? The most important resource to
optimize is
how does java score in comparison to c++ in terms of efficiency ?
Pitiful. Java is a platform, but you already have one, so another one on top
of it is a complete resource hog.
i guess java definitely has more libraries, more verbosity (for
clarity to programmers) etc etc.
Verbosity is not clarity. If you want clear lines, use a language like Ruby
that stays out of your way. Then you only write what's important, not the
endless paperwork Java makes you fill out just to get anything done.
The only concern is efficiency. How does java compare with C/C++ on
that ?
Google for "premature optimization is the root of all evil", then "alternate
hard and soft layers".

--
Phlip
Sep 30 '07 #3
On 2007-09-30 16:41, call_me_anything wrote:
choice between c and c++ is pretty obvious if the program is even
moderately big.

how does java score in comparison to c++ in terms of efficiency ?
i guess java definitely has more libraries, more verbosity (for
clarity to programmers) etc etc.
The only concern is efficiency. How does java compare with C/C++ on
that ?
What efficiency? Memory, CPU, development time? For what application
domain? How good is the developer's knowledge of the languages? A good
developer with a language they know will will always produce better (for
almost any definition of better) than a bad developer in a language he/
she does not know. Other factors that needs to be considered are what
platform the code will run on and what other applications/devices it
needs to interact with.

Java and C++ are both good and efficient languages, just not always for
the same kinds of problems. My advice is to go with the language that
you know best, unless for some reason that is not possible.

--
Erik Wikström
Sep 30 '07 #4
On Sep 30, 8:37 pm, Erik Wikström <Erik-wikst...@telia.comwrote:
On 2007-09-30 16:41, call_me_anything wrote:
choice between c and c++ is pretty obvious if the program is even
moderately big.
how does java score in comparison to c++ in terms of efficiency ?
i guess java definitely has more libraries, more verbosity (for
clarity to programmers) etc etc.
The only concern is efficiency. How does java compare with C/C++ on
that ?

What efficiency? Memory, CPU, development time? For what application
domain? How good is the developer's knowledge of the languages? A good
developer with a language they know will will always produce better (for
almost any definition of better) than a bad developer in a language he/
she does not know. Other factors that needs to be considered are what
platform the code will run on and what other applications/devices it
needs to interact with.

Java and C++ are both good and efficient languages, just not always for
the same kinds of problems. My advice is to go with the language that
you know best, unless for some reason that is not possible.

--
Erik Wikström
A strange reply to my question...
I am surprised that the meaning of efficiency wasn't clear.
What is the first thing that comes to mind when you talk about a
program's efficiency ?

A good developer... is amazing !
Nearly as bad as walking on road is equally dangerous as flying in a
plane because vehicles ply on road.

Answers like the others ones above were much better I guess.
This one was just consideration of too many factors many of which do
not apply.

Sep 30 '07 #5
call_me_anything wrote:
choice between c and c++ is pretty obvious if the program is even
moderately big.

how does java score in comparison to c++ in terms of efficiency ?
i guess java definitely has more libraries, more verbosity (for
clarity to programmers) etc etc.
The only concern is efficiency. How does java compare with C/C++ on
that ?
I'd choose the D programming language!

-------------
Walter Bright
http://www.digitalmars.com/d C, C++, D programming language compilers
Sep 30 '07 #6
On 2007-09-30 19:16, call_me_anything wrote:
On Sep 30, 8:37 pm, Erik Wikström <Erik-wikst...@telia.comwrote:
>On 2007-09-30 16:41, call_me_anything wrote:
choice between c and c++ is pretty obvious if the program is even
moderately big.
how does java score in comparison to c++ in terms of efficiency ?
i guess java definitely has more libraries, more verbosity (for
clarity to programmers) etc etc.
The only concern is efficiency. How does java compare with C/C++ on
that ?

What efficiency? Memory, CPU, development time? For what application
domain? How good is the developer's knowledge of the languages? A good
developer with a language they know will will always produce better (for
almost any definition of better) than a bad developer in a language he/
she does not know. Other factors that needs to be considered are what
platform the code will run on and what other applications/devices it
needs to interact with.

Java and C++ are both good and efficient languages, just not always for
the same kinds of problems. My advice is to go with the language that
you know best, unless for some reason that is not possible.
Please do not quote signatures.
A strange reply to my question...
I am surprised that the meaning of efficiency wasn't clear.
What is the first thing that comes to mind when you talk about a
program's efficiency ?
It depends on your background of course. For someone writing embedded
systems that do not perform any time-critical tasks memory efficiency
can often be much more interesting than speed. If you are in database or
some other storage-related industry then storage efficiency is more
interesting. Currently I am more interested in developer efficiency
since for the stuff I work with I have more than enough of both memory
and CPU power.
A good developer... is amazing !
Nearly as bad as walking on road is equally dangerous as flying in a
plane because vehicles ply on road.
Sorry, you lost me there.
Answers like the others ones above were much better I guess.
This one was just consideration of too many factors many of which do
not apply.
And you would have said the same thing if you had asked the same
question in a Java group and gotten the answers that Java was much
better than C++ because someone had written a slow C++ app once and some
other guy did not like the C++ syntax. (I meant no offence to Philip or
Mr. Tavares, I just want to point out that the OP did not have enough
information to make even an educated guess.)

--
Erik Wikström
Sep 30 '07 #7
call_me_anything wrote:
What efficiency? Memory, CPU, development time?
I am surprised that the meaning of efficiency wasn't clear. What is the
first thing that comes to mind when you talk about a program's efficiency
?
In the olden days, with 1 megahertz CPUs, of course program efficiency meant
carefully writing to avoid bottlenecks.

We all know that, and we have all taught ourselves to be very careful when
discussing abstract efficiency. The standard answer to this question is that
programmer efficiency is more important, because that frees up time in your
schedule to tune your code.

Premature optimization is the root of all evil.
This one was just consideration of too many factors many of which do not
apply.
Then share with us: Where is the "efficiency" requirement coming from?
What's the true meaning behind it?

--
Phlip
Sep 30 '07 #8
Why? Are you only concerned about speed? The most important resource to
optimize is
programmer time.

(Witness my short-term memory issues!;)

--
Phlip
Sep 30 '07 #9
call_me_anything wrote:
how does java score in comparison to c++ in terms of efficiency ?
It depends on what you are going to do.

There's a reason why almost all high-end computer games are made
in C++ and not in Java. OTOH, not all applications need that level
of efficiency.
Sep 30 '07 #10
Juha Nieminen wrote:
There's a reason why almost all high-end computer games are made
in C++ and not in Java. OTOH, not all applications need that level
of efficiency.
Yet Java does not even offer programmer efficiency...

--
Phlip
Sep 30 '07 #11
call_me_anything <sg********@gmail.comwrites:
choice between c and c++ is pretty obvious if the program is even
moderately big.

how does java score in comparison to c++ in terms of efficiency ?
This page has a fun comparison of a variety of languages with a
variety of benchmarks:

http://shootout.alioth.debian.org/

----Scott.
Oct 1 '07 #12
On Oct 1, 12:21 am, "Phlip" <phlip...@yahoo.comwrote:
Juha Nieminen wrote:
There's a reason why almost all high-end computer games are made
in C++ and not in Java. OTOH, not all applications need that level
of efficiency.
Yet Java does not even offer programmer efficiency...
It depends on your target. On the whole, I'd agree with you
(and it's no accident that, knowing both languages well, I do
most of my work in C++). But in cases where absolute
reliability isn't important, and portability---even to systems
you might not know exist---is, Java has its place. When you
have to deliver client software to a large, heterogeneous park,
you do gain programmer productivity by only having to compile
and test on one (virtual) platform. You don't have the
reliability of having actually tested on every target, but if
the code isn't critical (e.g. just some flashy interface, to
make things look good), the JVM is generally sufficiently
reliable for that. Thus, for example, I've seen more than a few
applications which use Java for a comfortable interface for
editing their configuration files, or displaying an overall view
of the system: which machines are running, which aren't, etc.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Oct 1 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what...
1
by: ptaz | last post by:
Hi I'm trying to run a web page but I get the following error. Ca anyone please tell me a solution to this. Thanks Ptaz HTTP Status 500 - type Exception report
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
0
by: mailkhurana | last post by:
Hii , I am trying to use a type 2 driver to connect to DB2 0n AIX 5 I have a small java test to class to establish a conneciton with the db .. I am NOT using WAS or any appserver When I try to...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
12
by: Mark Fink | last post by:
I wrote a Jython class that inherits from a Java class and (thats the plan) overrides one method. Everything should stay the same. If I run this nothing happens whereas if I run the Java class it...
0
by: jaywak | last post by:
Just tried running some code on Linux (2.4.21-32.0.1.EL and Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)) and Windows XPSP2 (with Java HotSpot(TM) Client VM (build...
1
by: jaimemartin | last post by:
hello, I want to validate an xml by means of a schema (xsd). To do that first of all I´m using a SchemaFactory. The problem is that if I run the code in Windows all works fine, but If I run it in...
0
oll3i
by: oll3i | last post by:
package library.common; import java.sql.ResultSet; public interface LibraryInterface { public ResultSet getBookByAuthor(String author); public ResultSet getBookByName(String name);
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.