Sign in to follow this  

compiling in different languages and speed

This topic is 4858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Would the reason a program using java/C++ be slower than writing it in assembly be because the compiler wasn't able to make the java/C++ code into as efficient machine code as if it was written in assembly? And would compiling a game in C++ generate faster/better machine code than programming/compiling the same game in java? [Edited by - lanemyer on August 25, 2004 2:47:27 PM]

Share this post


Link to post
Share on other sites
first to write a program in asm to be faster than a c++/java program u have to know a lot about how computers work

and java isnt compiled into machine code it is compiled into byte code witch is slower
so yes c++ is faster

Share this post


Link to post
Share on other sites
Quote:
Original post by lanemyer
Would the reason a program using java/C++ be slower than writing it in assembly be because the compiler wasn't able to make the java/C++ code into as efficient machine code as if it was written in assembly?


Probably not, it would probably be the way you've written the code & structured your program, it would probably mean you've written it inefficiently this is where you would profile your code later on.

Also "normal" java is dynamically compiled, it gets compiled to bytecode first then compiled to native code & executed on the fly, where as c++ is normally statically compiled but you can get static compilers for java & vise-verser.

Quote:
Original post by lanemyer
And would compiling a game in C++ generate faster/better machine code than programming/compiling the same game in java?


It depends on a number of things, again one being on how you've written your code if you write inefficent code in C++ its not gonna be any faster than same program written efficently in java. If you write code efficently in both then java maybe slower by around 5-10% but sometimes some java programs are faster it depends on what your doing & how you do it.

Share this post


Link to post
Share on other sites

This topic is 4858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this