Jump to content

  • Log In with Google      Sign In   
  • Create Account


[java] "Java faster than C in the average"


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 StratMan   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 September 2000 - 12:56 PM

Reference: Java Performance Report, http://www.javalobby.org/features/jpr/ The new section (Part III, Dated Sep 2, 2000), states in part: "IBM holds the best Java scores. Their performance is 60% as fast as Intel C/C++ in Integer code, and 72% as fast in FP code. Compared to Microsoft Visual C++ 6.0, IBM makes Java faster than C in the average, and this is a low-level benchmark that''s heavy on numerical and array code, so this is no mean feat." Amazing! The bottom line is: Java is almost as fast as C now for many things, and if you do game development in Java you will only need to break out into c++/JNI for mundane low level tasks such as talking to 3d cards and asynchronous i/o!

Sponsor:

#2 pcstiby   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 September 2000 - 10:16 PM

Java compilers one day will almost reach the speed of C++ compilers but never beat compiled C++ code because C++ dosn''t have slow down problem thanks to the garbage collection and data managment restrictions made, unfortunatly will never out perform games which are generally written in a C++/ASM combination.

Don''t get me wrong Java is a good language but it has its practicle uses as being the ideal platform for Application Service Providers thanks to platform independence and will take it place in the games world thanks to Set top box''s but don''t expect to see Java written Quake 3 for a while yet!

I program therefore can''t spell!

#3 felonius   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 September 2000 - 01:11 AM

pcstiby,

I think there is some things you don''t understand about Java. One of them is that garbage collection is not slower than normal manual clean up. Actually it has been shown to be faster in a lot of cases.

I think you should read this (a link from the forum FAQ)
http://www.rolemaker.dk/articles/WhyJavaCanBeUsedForGames/index.htm
before saying the things you do.

Jacob Marner



#4 MadKeithV   Moderators   -  Reputation: 971

Like
Likes
Like

Posted 07 September 2000 - 02:27 AM

Interesting benchmarks, but they have RTTI and Exception Handling turned on in the project settings... could affect performance.

However, it looks like they did their homework and showed that using the right VM, Java can seriously kick ass.


Give me one more medicated peaceful moment.
~ (V)^|) |<é!t|-| ~
ERROR: Your beta-version of Life1.0 has expired. Please upgrade to the full version. All important social functions will be disabled from now on.

#5 Jim_Ross   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 September 2000 - 03:38 AM

This guy forgot to mention GCJ. That is the gnu gcc compiler front end for java. Using that you can natively compile or even cross-compile java byte code (and source) into asm for almost any platform. The only catch is that GCJ still needs libs to run the compiled code against and there isn''t any AWT/Swing/GUI support yet. But if you use another GFX lib (like Qt, or libsdl) you can cross compile those into almost any platform. Also, you can compile java into asm code for systems that do not have a JVM and probably never will, like console systems.

This brings me to a thought I had a while ago and i''m wondering if anyone wants to help. Using java and GCJ to make a dreamcast demo or gameboy advance demo. I say demo because I''m being realistic about the limitations of GCJ and my own experience with these other platforms. If you are intereseted contact me and I will give you the docket of preliminary activities to setting up such a dev environment.

#6 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 07 September 2000 - 03:52 AM

Jim,

It could be way cool if somebody would do such a demo. Go for it.

But, as far as I know GCJ only support Java 1.0 which puts a limitations of what is possible. For instance if you need to access the Dreamcast hardware you need some kind of native interface and as far as I know GCJ doesn''t even support the old NMI interface (the one that existed before JNI). Correct me if I am wrong.

And with no user interface support or native support how would you go around doing anything useful on a console?

Jacob Marner



#7 Jim_Ross   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 September 2000 - 04:30 AM

Going back to the original topic for a sec, i found this post last year, my brother emailed it to me

http://www.aceshardware.com/Spades/read.php?article_id=153

Now, back to gcj. Here is the faq
http://sources.redhat.com/java/faq.html
And here is a quote from it

quote:
2.8 What features of the Java language are/aren't supported.
GCJ supports all Java language constructs as per the Java language Specification v1.0. Recent GCJ snapshots have added support for most JDK1.1 language features, including inner classes.


The only thing it really has a problem with is inner classes. Most of what it cannot handle is restricted to source code, if you can precompile into javabyte code, I think there is very little it cannot handle. It does support JNI now, but it has always had a better alternative CNI. It is like JNI but since the java byte code is going to be natively compiled the CNI knows this and takes advantage of it, leading to less overhead.

I have done my homework on this subject and it does seem feasible.

Edited by - Jim_Ross on September 7, 2000 11:31:44 AM

#8 felonius   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 September 2000 - 05:51 AM

Ok, sounds like some cool features has been added since I last looked at JGC.

What about portability to the Windows platform - or is it strictly UNIX? I know that Cygnus has made a gcc port for win32, but do you know if it likely that JGC will work with this?
I am concerned about this, as you know Jim, because I see the use of DirectX quite vital.
Using CNI might be a way to speed things up significantly.

Jacob Marner



#9 felonius   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 September 2000 - 06:04 AM

In answer to my own question:

JGC is actually distributed in binary form with Cygwin (the win32 GCC port) so it is ready to use when you install Cygwin.
Neat. JGC is turning out great.

The only thing that is a bit annoying though is that by CNI I will not be to use standard Java tools such a debuggers and profilers and of course that you no longer is portable across Java compilers.

Jacob Marner

#10 Jim_Ross   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 September 2000 - 07:20 AM

Wow i didn't notice that gcj came with gcc for win32, that's cool.

quote:
The only thing that is a bit annoying though is that by CNI I will not be to use standard Java tools such a debuggers and profilers and of course that you no longer is portable across Java compilers.


There are gnu debuggers that will work with CNI enabled java programs. As for the breaking of java code amongst other compilers - who cares?

Seriously, there aren't any other compilers that I know of that will compile Java code into SH4 machine code, so the term "portable across java compilers" makes no sense in that situation. CNI is faster and easier to debug than JNI, you are tying yourself to one platform when you natively compile, so i don't see being tied to one compiler as such a big issue.

Edited by - Jim_Ross on September 7, 2000 2:22:02 PM

#11 felonius   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 September 2000 - 08:40 AM

SH4? What does that mean? If you mean really fast then the Visual Cafe 4.0 Expert edition and IBMs Visual Age for Java Enterprise edition compilers produce quite fast code too - in machine code.

The only GNU debugger available is gdb. That is text-based. There is a visual front-end called ddd (I think) but that has as far as I know only been written for X-Windows.

So by tieing myself to one compiler and and prevented from using visual debuggers and other utilities such as profilers, memory leak detectors, IDEs (you may argue that MAKE is better, but lets leave that discussion for another time) and so on.
So I think that being cross compiler portable even on the same platform is an issue worth caring for.

Being cross compiler portable means for instance that I can just throw in Java3D in my Symantec native code compiler, compile it and go. This is the issue with any 3rd party library that uses JNI. I like that.

Anyway, I think it is still a bit risky to use JGC for larger projects because it still seams to be fairly early in development. But much has happened since I looked at it the last time so things are certainly getting better. Maybe in a year or two it may really worth basing major projects in it. When this time has come is somewhat subjective though, so you might disagree. And I am problably quite biased. I already have a quite large code base using JNI and it would require significant work to redo in CNI.

One other thing. It is quite risky to base your development on one compiler. It might be bugged and you would then be unable to change compiler underway. Take for instance the Visual J++ that uses Microsofts RNI. Now that C# has come it is unlikely that J++ will be come in any new versions. If I had a code base written using RNI I would probably have to port it all to JNI (or CNI) now if I wanted to reuse that code.

Jacob Marner

#12 Jim_Ross   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 September 2000 - 04:32 AM

What I''m saying is that it is the only compiler that will do what I want. There are 0 others that will do what I want. When you say Visual Cafe produces fast machine code you are stuck in the mindset that I am writing Intel based programs. I am not going to write something that will execute on a desktop or server that runs on an x86 CPU. So far GCJ is the only compiler i know that will make non-x86 machine code. If you can find another one then please tell me.

SH4 is the main CPU for the dreamcast (it doesn''t run a pentium anything)



#13 felonius   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 September 2000 - 04:54 AM

I am totally aware that you don''t work on Intel based machines. I am not (and was not) stuck in any "mental midset". I just didn''t know what SH4 meant, thats all.

I have had plenty of experience myself with other architectures. For one thing I wrote a book on low-level programming on the Digital Alpha-architecture last year and taught a class (as an assistent teacher) in that same subject. I have programmed MIPS assembler and have used gcc a lot on both HP-UNIX, Linux and Digital UNIX.

And as for "portable" native code you are probably right. JGC is the only way to go. In fact, because use a using the same C++ compiler on all the platforms you will even be able to write somwhat portable libraries using CNI - assuming of course that you stay within the POSIX standard - and that the platform you are running on is UNIX. Of course - if you cross compile to the SH4 then there will be no such services available (I here assume that no UNIX version is available for the Dreamcast; only a gcc backend)

Jacob Marner




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS