This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Calculator Programming subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. General Coding and Design => Calculator Programming
Author Message
wrigley


Advanced Member


Joined: 19 May 2004
Posts: 399

Posted: 11 Jun 2005 11:06:41 am    Post subject:

What you have read would be both true and stil not true, because the speed optimising in Java perhaps is easier to implement than in C, I don't know. And if we this is the case to the general programmer, Java would be faster. But if we imagine the programmers skill to be unlimited, writing faster or even same-speed code in Java would be impossible. Here's why:

If you write in C once your program is written, you would compile it to binary language, which when executed would run at top speed.

If you write in Java (or any other interpreted language) once your program is written, you would compile it to new code, which when executed had first to be interpreted before being able to run at top speed.

This means that any (well coded) non-interpreted language, would always be faster than its interpreted counterpart, as it does not need to be interpreted before being able run.

/wrigley
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 11 Jun 2005 11:27:52 am    Post subject:

With intelligent/just-in-time interpreters, this is not nessecarily true as the delay from interpreting it is drastically reduced and then some. It also depends on how efficient the code that is actually executed is, a C program can be compiled into such inefficient binary code that, in the end, it runs slower than an interpreted program that is compiled into such efficient code that it overcomes the delay in speed caused by the actual interpreting.

Also, C is rather slow with I/O operations compared to other languages, and I believe Java is faster with some kind of calculation (I don't think floating point math, but something like that). Therefor, even if the program is technically perfectly written it could still very easily be slower than an interpreted language that is faster at performing I/O operations. I don't know if this is caused by the specific instructions given by compiled c code being slow or simply because I/O operations are compiled into inefficient code.

In the end though, generally speaking Java and C's speed are very much comparable. Java, and probably many interpreted languages with it, simply is very fast.

Java does use more RAM though, since the runtime environment needs to be loaded, so that could cause slower performance, but I wouldn't be surprised if it's great at threading.

The issue is comparable to C++'s development. When it was still new it was very slow, as was Java, but these days it's practically as fast as C is, maybe even faster. Many people still think it's slow though, probably after reading old articles. :+


Last edited by Guest on 11 Jun 2005 11:37:36 am; edited 1 time in total
Back to top
wrigley


Advanced Member


Joined: 19 May 2004
Posts: 399

Posted: 11 Jun 2005 01:20:32 pm    Post subject:

I/O are not actually part of the core C/C++ language, they reside in library files usually included with the compiler. If these I/O operations are too slow, the imaginary programmer whose skill is unlimited (as supposed in my example from before) he would simply write new I/O functions that were faster (a thing which by the way is not possible, as far as I know in Java).

In the real world however, no programmer has unlimited skill, and also it would be a bit over the top writing a whole set of I/O-functions for say a mere "Hello world!" program Very Happy . Therefore the speed could easily be better for Java code, when counting in factors such as the skill and the time required to write the code. So all in all, different languages will have the advantage in different cases.

/wrigley
Back to top
CoBB


Active Member


Joined: 30 Jun 2003
Posts: 720

Posted: 13 Jun 2005 03:32:05 am    Post subject:

Arcane Wizard wrote:
In the end though, generally speaking Java and C's speed are very much comparable. Java, and probably many interpreted languages with it, simply is very fast.

While wading through lots of applications in my life I've always had the experience that C code is still orders of magnitude faster than the corresponding Java code. C++ is even better, because current STL implementations are really fast, often outperforming handcrafted C code. The difference is spectacular when you use the low level API (e. g. win32 or X) to create the UI and handle events, but Java is also insuitable for data/calculation intensive tasks if you value your time.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page Previous  1, 2
» View previous topic :: View next topic  
Page 2 of 2 » All times are UTC - 5 Hours

 

Advertisement