Thread: Speed of C++

  1. #31
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Quote Originally Posted by Wraithan
    but I have intentionally used Java
    blasphemy!

  2. #32
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Aside from I/O system speed, the above tests also reflect the JVM startup overhead, which will always be there, and always become insignificant on any real tests.

    That's why you do performance measuring inside the program, not outside.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #33
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Well IMHO it doesn't matter which is faster if I can just display "Hello World!" fast enough.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

  4. #34
    Drunken Progammer CaptainMorgan's Avatar
    Join Date
    Feb 2006
    Location
    On The Rocks
    Posts
    45
    My instructor this past fall claimed that an equivalent program that was originally written in C++ is actually faster when written in Java. So should I strangle him?


    -Capt

  5. #35
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    No, just the people who wrote the original C++ program
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #36
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Quote Originally Posted by CornedBee
    No, just the people who wrote the original C++ program
    lol, well since he was saying ANY C++ program we better start strangling ourselves

  7. #37
    Drunken Progammer CaptainMorgan's Avatar
    Join Date
    Feb 2006
    Location
    On The Rocks
    Posts
    45
    Quote Originally Posted by Laserve
    lol, well since he was saying ANY C++ program we better start strangling ourselves
    That is what my instructor was implying so we're in trouble.

  8. #38
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Quote Originally Posted by CaptainMorgan
    That is what my instructor was implying so we're in trouble.
    well, it's completely retarded to say things like that. He probably just likes java more because he was too incompetent to learn C++ completely

  9. #39
    Drunken Progammer CaptainMorgan's Avatar
    Join Date
    Feb 2006
    Location
    On The Rocks
    Posts
    45
    Quote Originally Posted by Laserve
    well, it's completely retarded to say things like that. He probably just likes java more because he was too incompetent to learn C++ completely
    actually, you're probably quite accurate. He is a Java programmer by trade and was forced to teach C++ this past semester by the dept head.

  10. #40
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Moved to the comedy store since it's degenerated into a "yeah but" argument.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  11. #41
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I'm really not going into the debate of which is faster, C++ or Java.
    So, you can stop reading now.

    There's a strong attitude from Java programmers towards C++. Not all, but a sizeable number. Sizeable enough to probably become representative.

    I'm not really sure why. Maybe because the syntax is similar. Maybe because bot languages can be used to solve the same problems on most programming domains. There's simply an aversion towards C, and especially C++. And traditionally, the argument that gets always debated, is that of speed. I'm not surprised though. There's also the same strong attitude from most C or C++ programmers towards programming languages the likes of Visual Basic or Delphi, for instance. It reveals the same ignorance. No one is perfect and C++ programmers are certainly not an exception.

    That programmers, some of them being professional programmers, actually discuss speed as an argument for which is a better programming language is overwhelmingly sad. It is really the state of things. They learn nothing in the University, and they learn even less in the work place where the few remnants of a sane programming culture of the 80s and 90s is quickly be thrown to the waste bin.

    Except for performance critical applications, or applications dabbling in those few areas still in existence today where computational power is still in high demand (3D, for instance), speed is of no concern. None whatsoever. In fact, as CornedBee pointed out, speed concerns have the power to turns against the programmer and create a much harder to maintain application or even a buggy one.

    It's an ignorant thing to say that one language is better than another because its faster. And under most circumstances it is even ignorant to try and compare languages based on speed. Programming languages are certainly meant to be fast. Of course. It would be ridiculous otherwise. But today's performances on most top programming languages is very agreeable to the demands of most applications. The differences are minimal and for most applications (and I mean a way lot, darn it!) one can concentrate on other much more important aspects of the programming language; Can it be used to solve my problem? Does it have the right tools? Will it take me more or less time to solve my problem? Will it allow me to quickly maintain my code? etc...

    Speed? Speed is for whiners!
    Last edited by Mario F.; 01-10-2007 at 07:43 AM.
    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.

  12. #42
    Drunken Progammer CaptainMorgan's Avatar
    Join Date
    Feb 2006
    Location
    On The Rocks
    Posts
    45
    bravo

  13. #43
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    The differences are minimal and for most applications (and I mean a way lot, darn it!) one can concentrate on other much more important aspects of the programming language; Can it be used to solve my problem? Does it have the right tools? Will it take me more or less time to solve my problem? Will it allow me to quickly maintain my code? etc...
    I don't know... Maybe it is only my bad luck?.. But... I have to support some suite of applications... Ok we have some agents that should work in RT and speed is essential... (have we tried 4 CPU Intel Server,... yeah... sadly it is not enough... Let's try to split more...) So here is no question how essential speed is...

    But on the other hand we have a report generator. Let's forget about speed and concentrate on... what was that? "Can it be used to solve my problem? Does it have the right tools? Will it take me more or less time to solve my problem? Will it allow me to quickly maintain my code? etc" Yes... it works fine, till it goes to some customer that want to generate report for his simulation that was running during a month... And he does not want to wait 3-4 hours till the report will be build (he is not intrested to know what number of Megabytes to be parsed to generate report, he just wants to get the report in minutes, not hours)...

    so no, I don't have any application to support, where the time issue is not critical... Bad luck?
    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

  14. #44
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Quote Originally Posted by Mario F.
    Speed? Speed is for whiners!
    I would agree with you 100% if not for the fact that you're only looking at your own domain.
    The speed issue is no issue at all anymore on desktop and client/server applications.
    For instance, I had to make a big web application (on windows) a few years ago in which the customer demanded a certain performance. Like 20 web requests a second should be possible and 1 request involved parsing parameters, a database lookup, transform the results via xml/xsl to html and send back to browser. All that in 50ms you say, thats impossible! Of course not, we didnt have to look at all at code performance because if the application turned out to be too slow another server was added. In the end we ended up with 6 servers put behind a load balancer with the webserver tweaked for performance and all that crap. Performed like a maniac!

    Where I dont agree with you is that I code gambling machines (on video) now on an m68k processor with a bit crappy videocard to say the least. Coding without regard to performance is just not possible. You will meet the system boundaries all too soon and you will find yourself constantly in a battle against the processor/amount of memory.

  15. #45
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by Mario F.
    I'm not really sure why.
    Could be historical. Java was created as "a better C++". Quite literally.

    I don't think there's a precedent for this situation: where one language that was from the beginning meant to be "better" than another gained a sizeable following, but the original language survived, too. That would explain why there's so much hate between the two camps.

    Personally, I simply enjoy that knowing both languages is so little additional hassle, and use both, whichever I happen to need at the moment. (My primary domain currently being web applications, that's all too frequently Java.)
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

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