April 2nd, 2002, 10:32 PM
C or C++ for high-traffic CGI ?
Hi all, I'm new here - just got referred here from an adult webmaster board.
I am interested in writing a CGI app for traffic trading on high-volume websites (300,000+ visitors daily). There already is a couple of good scripts like UCJ, which are either written in PHP, or C. I already have experience with C++ and will work more with it in the next couple of months. Other webmasters told me that C++ wasn't as suitable for that task just because it enabled the developer to write sloppy code and that it was slower overall (which is rather important)... the script will use mysql as its database and not files.
Any suggestions/comments welcome !
April 3rd, 2002, 02:55 PM
I would say that if you are more familiar with C++, then you should use C++.
The risk of writing sloppy code will be greatly reduced when you feel confident with the language you're using.
It is a common misconception that C++ is slower than C. I am sure that someone reading this will be more than happy to challenge my position on this subject, and I am sure they have a lot of fascinating facts about machinecode etc, but todays compilers are very good at optimizing and I really don't think there is that much difference.
Especially when coding CGI I don't think any differences will be noticable.
I'm afraid I don't know exactly what "traffic trading" entails, but these are my 2 cents anyway.
March 7th, 2003, 04:30 AM
CGI programs are not better for high-traffic applications that PHP or ASP scripts.
CGI programs are faster for medium-traffic applications, where every script performs a lot of calculations in loops. That could be crypto-stuff like generating huge primes, image processing, parsing complex input data and so on.
March 7th, 2003, 04:33 AM
Also, when you are using database servers and stuff like that, they become the bottleneck of you app's performence.
For really high-traffic app, I would use plain text files if possible - SQL based relational databases are kinda slow for that purpose.
By the way, I don't think that you get any difference in performance whether you use C or C++.