#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Posts
    0
    Rep Power
    0

    Question 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 !

    Thanks, Nox
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    Sweden
    Posts
    0
    Rep Power
    0
    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.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    61
    Rep Power
    12
    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.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    61
    Rep Power
    12
    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++.

IMN logo majestic logo threadwatch logo seochat tools logo