I read all over the web about how scripting programming languages (like ruby or python) are fast for writing programs quickly. so i would like you to consider a programming project that is :
1- the length of source code is in the magnitude of few hundreds to few thousands lines of code.
2- not a low level (driver / OS level) program.
question : since developing my program in ruby or python will be much faster(i assume) what are the reason(s) why i should consider using c++ over ruby /python for such project ?
sharing your practical experience will be greatly appreciated.
thank you
7 replies to this topic
#1
Posted 18 May 2010 - 11:50 AM
|
|
|
#2
Posted 18 May 2010 - 11:52 AM
#3
Posted 19 May 2010 - 07:30 AM
It depends on the details. If performance is an issue, C++ might still win. If you are writing programs that perform small, simple tasks where a few milliseconds or seconds don't matter, then C++ probably doesn't have any advantages. It all comes down to what performance characteristics you need.
#4
Posted 19 May 2010 - 10:21 AM
If performance is issue and the project is going to be large, C++ is almost never a win. C++ is a performance win, only if you have plenty of time to hand-optimize it, which is almost never a case in a large project. C++ wins in small benchmarks, but it does not scale well.
The same applies to comparing assembly to C++ - assembly wins in small benchmarks by a large margin than C++ (when you are a real expert in assembly), but creating a whole system in assembly you are very unlikely to get better performance than you would in C++.
C++ is good, if you have hard-real time constraints and scarce memory. Which happens pretty seldom.
The same applies to comparing assembly to C++ - assembly wins in small benchmarks by a large margin than C++ (when you are a real expert in assembly), but creating a whole system in assembly you are very unlikely to get better performance than you would in C++.
C++ is good, if you have hard-real time constraints and scarce memory. Which happens pretty seldom.
#5
Posted 19 May 2010 - 01:04 PM
JCoder said:
If performance is issue and the project is going to be large, C++ is almost never a win. C++ is a performance win, only if you have plenty of time to hand-optimize it, which is almost never a case in a large project. C++ wins in small benchmarks, but it does not scale well.
The same applies to comparing assembly to C++ - assembly wins in small benchmarks by a large margin than C++ (when you are a real expert in assembly), but creating a whole system in assembly you are very unlikely to get better performance than you would in C++.
C++ is good, if you have hard-real time constraints and scarce memory. Which happens pretty seldom.
The same applies to comparing assembly to C++ - assembly wins in small benchmarks by a large margin than C++ (when you are a real expert in assembly), but creating a whole system in assembly you are very unlikely to get better performance than you would in C++.
C++ is good, if you have hard-real time constraints and scarce memory. Which happens pretty seldom.
that is shocking post for me. shall you point for me a research paper for this ? or this is just personal xp ?
#6
Posted 19 May 2010 - 01:22 PM
JCoder spends a lot of his time bashing C++ and extolling the virtues of Java. Some of his points are valid, others less so (IMHO). He also tends to overlook some of Java's limitations. I take a lot of his language war statements with a grain of salt.
#7
Posted 19 May 2010 - 09:19 PM
I didn't refer to Java anywhere in this post. Any "fast" high level language can easily beat C++ on a large project, both in performance and in code maintainability. This is often Java or C#, because they are popular in the enterprise market, however, it can be also Scala, F#, Haskell, Erlang, OCaml etc.
And this is not just my personal experience. Look at things like Apache Webserver ©, MySQL (C++), Quake (C++) etc. They all have Java equivalents that are comparable in performance (Tomcat, Jake) or even faster (HSQLDB, H2). Performance advantage of C++ is overhyped - it is visible in benchmarks, not in real code. For many of the optimizations usually done in benchmarks, you would get fired from the real project - because they make code unmaintainable.
In benchmarks you can pass pointers between functions/components. This is fast. But this is in many cases unsafe. Almost all standard C++ structures are mutable, memory management is tricky to get right - this requires lots of defensive copying, defensive bound checking or additional management code (smart pointers) which is a cost you don't have to pay in HLLs. Smart pointers are a much higher overhead than proper GC, mutable data structures are dead slow, when you need to copy them (and often you do, to prevent hidden data dependencies), dynamic allocation is 5-10x slower than Java's new, inlining of dynamically linked functions is not possible, synchronization cannot be elided at runtime, thread based concurrency model does not scale well - there are lots of places, where C++ performance lags behind Java/C#/Erlang/Haskell/OCaml/.... Ofc, this cost is never measured by benchmarks, which test simple numeric crunching you would probably never use in your project... But - you decide. :)
And this is not just my personal experience. Look at things like Apache Webserver ©, MySQL (C++), Quake (C++) etc. They all have Java equivalents that are comparable in performance (Tomcat, Jake) or even faster (HSQLDB, H2). Performance advantage of C++ is overhyped - it is visible in benchmarks, not in real code. For many of the optimizations usually done in benchmarks, you would get fired from the real project - because they make code unmaintainable.
In benchmarks you can pass pointers between functions/components. This is fast. But this is in many cases unsafe. Almost all standard C++ structures are mutable, memory management is tricky to get right - this requires lots of defensive copying, defensive bound checking or additional management code (smart pointers) which is a cost you don't have to pay in HLLs. Smart pointers are a much higher overhead than proper GC, mutable data structures are dead slow, when you need to copy them (and often you do, to prevent hidden data dependencies), dynamic allocation is 5-10x slower than Java's new, inlining of dynamically linked functions is not possible, synchronization cannot be elided at runtime, thread based concurrency model does not scale well - there are lots of places, where C++ performance lags behind Java/C#/Erlang/Haskell/OCaml/.... Ofc, this cost is never measured by benchmarks, which test simple numeric crunching you would probably never use in your project... But - you decide. :)
#8
Posted 21 May 2010 - 01:48 PM
JCoder said:
I didn't refer to Java anywhere in this post. Any "fast" high level language can easily beat C++ on a large project, both in performance and in code maintainability. This is often Java or C#, because they are popular in the enterprise market, however, it can be also Scala, F#, Haskell, Erlang, OCaml etc.
And this is not just my personal experience. Look at things like Apache Webserver ©, MySQL (C++), Quake (C++) etc. They all have Java equivalents that are comparable in performance (Tomcat, Jake) or even faster (HSQLDB, H2). Performance advantage of C++ is overhyped - it is visible in benchmarks, not in real code. For many of the optimizations usually done in benchmarks, you would get fired from the real project - because they make code unmaintainable.
In benchmarks you can pass pointers between functions/components. This is fast. But this is in many cases unsafe. Almost all standard C++ structures are mutable, memory management is tricky to get right - this requires lots of defensive copying, defensive bound checking or additional management code (smart pointers) which is a cost you don't have to pay in HLLs. Smart pointers are a much higher overhead than proper GC, mutable data structures are dead slow, when you need to copy them (and often you do, to prevent hidden data dependencies), dynamic allocation is 5-10x slower than Java's new, inlining of dynamically linked functions is not possible, synchronization cannot be elided at runtime, thread based concurrency model does not scale well - there are lots of places, where C++ performance lags behind Java/C#/Erlang/Haskell/OCaml/.... Ofc, this cost is never measured by benchmarks, which test simple numeric crunching you would probably never use in your project... But - you decide. :)
And this is not just my personal experience. Look at things like Apache Webserver ©, MySQL (C++), Quake (C++) etc. They all have Java equivalents that are comparable in performance (Tomcat, Jake) or even faster (HSQLDB, H2). Performance advantage of C++ is overhyped - it is visible in benchmarks, not in real code. For many of the optimizations usually done in benchmarks, you would get fired from the real project - because they make code unmaintainable.
In benchmarks you can pass pointers between functions/components. This is fast. But this is in many cases unsafe. Almost all standard C++ structures are mutable, memory management is tricky to get right - this requires lots of defensive copying, defensive bound checking or additional management code (smart pointers) which is a cost you don't have to pay in HLLs. Smart pointers are a much higher overhead than proper GC, mutable data structures are dead slow, when you need to copy them (and often you do, to prevent hidden data dependencies), dynamic allocation is 5-10x slower than Java's new, inlining of dynamically linked functions is not possible, synchronization cannot be elided at runtime, thread based concurrency model does not scale well - there are lots of places, where C++ performance lags behind Java/C#/Erlang/Haskell/OCaml/.... Ofc, this cost is never measured by benchmarks, which test simple numeric crunching you would probably never use in your project... But - you decide. :)
thank you so much ,you saved my ass !
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









