Thread: Speed of C++

  1. #1
    Matt Conway bobthebullet990's Avatar
    Join Date
    Nov 2005
    Location
    Cambridge
    Posts
    122

    Speed of C++

    Hi!!! ...after reading a few debates on the net about execution speeds, is C++ really faster than Java? ...It appears that some believe it is and that others believe it depends on the job of the application... any views? Its just some research I am doing for my project! To see which language to use! ...Im doing a real-time monitoring user interface to interface with some low level C audio effect algorithms that I have written!

    Thanks for any opinions!
    Many junglists take pride in their belongin to what may be referred to as a globalised drum & bass subculture, as a subculture though, it is not nearly as distinct at gothic or punk!

  2. #2
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    This gets asked alot, yes c++ is and can be alot faster

    http://www.jelovic.com/articles/why_java_is_slow.htm

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Insane Game Developer Nodtveidt's Avatar
    Join Date
    Nov 2006
    Location
    Isabela, PR
    Posts
    105
    As with most things programming-related, it depends on the skill level of the coder, the algorithms used in the particular program, the platform it's executed on, and a host of other details. Benchmarks of various applications on various platforms put Java above C++ in a few areas but C++ tends to win out most of the time. If you're going to be doing some sort of time-critical application on x86-based architecture, Java is not the way to go.
    Code:
    cout << "Language comparisons are dumb";
    echo("Language comparisons are dumb");
    PRINT "Language comparisons are dumb"
    alert ("Language comparisons are dumb")

  5. #5
    Matt Conway bobthebullet990's Avatar
    Join Date
    Nov 2005
    Location
    Cambridge
    Posts
    122
    thanks! ...For my final year undergrad project, I'm doing a real-time audio effects processor; this uses some specialised DSP hardware that connects to the host machine via parrellel cable; I know this is not great because its damm slow! ...the host machine runs a GUI that the user uses to select an effect and gives full control over effect variables so they can warp the signal however they fancy! this GUI has to be a real-time monitoring system and sends messages to the DSP board about the changes if any in the parameters so the DSP then changes the effect! ...the effects are all C algorithms stored in the DSP boards memory!

    However, for my write-up, I have to explain why I have chosen C++ over Java for the GUI; the real reason is because I hate java, I think it sucks!
    ...But I can't write this! ... I have to give a few good reasons why I have chosen C++ over say Java or other OO's!!! so am just comparing speeds, but it seems as if some ppl believe Java is faster than C++, but most vice versa! however, I can't seem to find that key reason why Java would be slower! ...I will continue to search the net!!!

    ...and my operating system is Win XP, Pentium 4
    Many junglists take pride in their belongin to what may be referred to as a globalised drum & bass subculture, as a subculture though, it is not nearly as distinct at gothic or punk!

  6. #6
    Registered User
    Join Date
    May 2006
    Posts
    630
    Quote Originally Posted by bobthebullet990
    thanks! ...For my final year undergrad project, I'm doing a real-time audio effects processor; this uses some specialised DSP hardware that connects to the host machine via parrellel cable; I know this is not great because its damm slow! ...the host machine runs a GUI that the user uses to select an effect and gives full control over effect variables so they can warp the signal however they fancy! this GUI has to be a real-time monitoring system and sends messages to the DSP board about the changes if any in the parameters so the DSP then changes the effect! ...the effects are all C algorithms stored in the DSP boards memory!

    However, for my write-up, I have to explain why I have chosen C++ over Java for the GUI; the real reason is because I hate java, I think it sucks!
    ...But I can't write this! ... I have to give a few good reasons why I have chosen C++ over say Java or other OO's!!! so am just comparing speeds, but it seems as if some ppl believe Java is faster than C++, but most vice versa! however, I can't seem to find that key reason why Java would be slower! ...I will continue to search the net!!!

    ...and my operating system is Win XP, Pentium 4
    What kind of effect/DSP hardware?
    Are you making vst plugins?

  7. #7
    Matt Conway bobthebullet990's Avatar
    Join Date
    Nov 2005
    Location
    Cambridge
    Posts
    122
    nope... its an external DSP board, the Texas Instruments 6711 DSK, but with the PCM3003 Audio daughter card to get sampling rates of 48khz cause onboard codecs are only 8khz which isn't good for audio effects!!!

    Its similar in the idea to a professional effects unit, such as the EFX1000 by pioneer, but obviously nowhere near the complexity and functionality of that thing!!! ...but the idea is for streaming audio, either for DJ use or even guitar effects! ...It has an input port, for the input data obviously, and an output port... for the output audio, connect this to ur amp and u have an effects unit!

    Its only so I could try something new; DSP programming and understand a bit more about audio effects, as my hobby is DJ'ing! so it is very interesting for me!
    Many junglists take pride in their belongin to what may be referred to as a globalised drum & bass subculture, as a subculture though, it is not nearly as distinct at gothic or punk!

  8. #8
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    In general, C++ is faster than java. Sure you can do contests with average C++ coders against experienced java coders and the java coders would win.

    You need experience to write fast code in Java,
    you need experience to write correct code in C++


  9. #9
    Insane Game Developer Nodtveidt's Avatar
    Join Date
    Nov 2006
    Location
    Isabela, PR
    Posts
    105
    An expert QBASIC coder can code circles around a beginner C++ coder. But that's another story for another day.
    Code:
    cout << "Language comparisons are dumb";
    echo("Language comparisons are dumb");
    PRINT "Language comparisons are dumb"
    alert ("Language comparisons are dumb")

  10. #10
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Will we ever agree one day that

    1. It doesn't matter which is faster,
    2. It's impossible to answer this general question,
    3. And when detail is brought fourth and the question answered, It still will not matter which is faster.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #11
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Quote Originally Posted by Mario F.
    Will we ever agree one day that

    1. It doesn't matter which is faster,
    2. It's impossible to answer this general question,
    3. And when detail is brought fourth and the question answered, It still will not matter which is faster.
    Speed absolutely matters. If you have two applications, and one significantly outperforms the other, it matters. If you have customers who use your application and they cannot accomplish their task in a reasonable amount of time because of the lack of speed of the application, it matters. If you are trying to accomplish as much work as possible with an application within a given time frame, it matters.

    Just because the question is beaten to death, is often irrelevent to specific contexts, and has its importance misunderstood by many, doesn't mean the question doesn't matter.

  12. #12
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Differences in speed between two languages are not of any importance for most applications. For every 1 application you tell me it is, I can name 2 it isn't.

    You sure can see past the apparent sttrictness of my previous post.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  13. #13
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    ...and if your user interface takes 3ms to respond instead of 2ms... it does not matter, because humans can't notice such a difference.

    Speed is a poor argument point for a UI decision. You should justify the use of C++ because you don't want your application to require a 3rd party JVM or something like that.

  14. #14
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> You sure can see past the apparent sttrictness of my previous post.
    I felt that your exaggeration was misleading and offered my take on the subject. "Arrays are evil" statements are fine, IMO, because in 99% of cases that is true and in many cases the beginner doesn't realize that the number is that high. However, identifying which solution is more appropriate for a given problem is perfectly acceptable, and hyperbolic statements implying that speed never matters in such a discussion are just wrong. Speed does matter and should be taken into consideration even if the final resolution is that the speed difference is negligible.

  15. #15
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Actually the "arrays are evil" is an excellent example. 99% is a gross exaggeration. And consequently could be seen as misleading. And yet no one becomes less knowledgeable when you say it and the point is taken.

    Such same thing happened when I said speed doesn't matter. My point was surely well taken. You certainly understood it.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I am very new . . . :(
    By Eternalglory47 in forum C++ Programming
    Replies: 6
    Last Post: 09-05-2008, 11:29 AM
  2. Flight Simulator Wind Speed!!
    By Dilmerv in forum C++ Programming
    Replies: 6
    Last Post: 03-20-2006, 12:40 AM
  3. Replies: 6
    Last Post: 01-08-2006, 02:49 PM
  4. increased net speed
    By PING in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 03-29-2005, 07:05 AM
  5. Questions on Speed of Execution
    By wavering in forum C Programming
    Replies: 22
    Last Post: 01-20-2002, 02:04 PM