[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

C/C++ or Perl - Which is better?

Posted on 1998-09-07
1
Medium Priority
?
180 Views
Last Modified: 2013-12-25
I can think of a few reasons why Perl is better when it comes to CGI programming. However,I heard that C/C++ is more efficient and works faster for more complicated applications. Is this true? Are there any other reasons to choose C/C++?
0
Comment
Question by:zgee
1 Comment
 
LVL 11

Accepted Solution

by:
mouatts earned 80 total points
ID: 1828565
C is compiled whilst Perl is interpreted as a result a C program will tend to be faster. But this speed difference is very much on the margins a very complex CGI or a heavily hit site may gain a noticeable benefit but otherwise delays in the network will hide any real improvement.

Although Perl is available under NT there are some Web Servers that cannot execute it. For example the Oracle Web Server assumes that a CGI will be a .exe. There is a way around this problem but it is very much a hack that should be avoided. Nevertheless this is a portablility issue.

On the otherhand some would say that it is harder to write a C program that it is portable. It is probably true to say that it is easier to write a portable Perl program than a portable C program but realistically portable C CGIs are within the capabilities of most C programmers.

If you CGI is talking to a database it is possible that a C program may be able to talk directly with it whereas a Perl program may be limited to ODBC only. This can restrict the things that can be done and will incur a significant speed penalty. (Due to ODBC rather than the language that called it).

There are potentially some other reasons such as all the update code for a database is written in C and some of the C functions can be reused within a CGI. This is of course equally true of Perl. But if a company has invested time and money in developing one skill set there is a reluctance in spending even more to pick up another unless there is an overiding advantage to the alternative language. Frankly the advantages of C over Perl or vice versa are generally so small that such an investment is not worthwhile.


0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month17 days, 15 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question