C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old June 14th, 2002, 04:48 PM
dmittner dmittner is offline
Dazed&Confused
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Tempe, AZ
Posts: 91 dmittner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 34 m 13 sec
Reputation Power: 7
Send a message via ICQ to dmittner Send a message via AIM to dmittner
Perl vs. C/C++

I'm a kid in heart (and not too far off in maturity level) and enjoy designing games with the knowledge of programming that I have. Unfortunately, my knowledge of C/C++, the ideal language for creating MUDs (Multi-User Dungeons) is lacking next to my knowledge of Perl.

After searching around the internet, I've come upon a simple Perl-based MUD codebase which I know I could build up very quickly to the levels of quality of C/C++ based MUDs in features and appearance. However, I know that Perl's flexibility comes with a price of speed. What price would I be paying? Half as slow, one third? I know it would depend on the functions used, so just a general estimate would help.

I also wish to impliment MySQL in to it. I've dabbed in using MySQL with C once before, and the code I wrote, albiet with a good level of ignorance, was much more bulky than it's Perl equivalent. Is this common or can MySQL be as streamlined in C as it it can be in Perl and still offer reasonable error-checking? Also, does one language offer better MySQL support than the other?

Thanks,
Dave Mittner
Ignorant C Programmer

P.S. One of the major reasons I'd like to use Perl are hashes. I know C/C++ has hashes as well, but in researching them I was utterly confused. Needless to say they don't appear anywhere near as simple as Perl's. In the end, though, would they offer similar functionality or would I be out of luck there if I went with C?

Reply With Quote
  #2  
Old June 14th, 2002, 05:18 PM
chance chance is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 4 chance User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
There is a very hig probability that if you optimize the hell out of both
a Perl version and a C version, the C version would be faster.
The question is how much faster and for how much more effort?

I'd recommend going ahead and doing it in Perl first.

To accurately answer the question about performance without doing
two implementations would probably take about as much time
and effort as actually just implementing it twice and just
comparing. So I'd do it the easy way first (Perl) and _if_ performance
is not acceptable, then see if you make your perl faster, and then if
that isn't good enough, then do a partial or complete redo in C.
Try to keep this possible scenario in mind when doing the perl.
I.e. write good modular software. Maybe even put placeholder
wrappers around things like hashes that you know would require
some extra kung fu if done in C.

Both languages are turing Complete and can do anything any
the other language could do.

Reply With Quote
  #3  
Old June 14th, 2002, 06:58 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
I will say that if you know perl better, definately try that one first. Both are very powerful, but one drawback to C is that you have to do it a while before you can really learn to optimize it and use the real tricks that save you major time and processing power.
The big plus between going for perl is its database interaction, which is a little easier to learn than doing it in C. If you decide to use C, then do a little research to see if you can find any libraries that have been built to use database calls before trying it on your own. From there you can learn a little more about some of the tricks about C. Plus, you really have to watch your pointers, a pointer out in the forest can crash it all, which in short, be careful using pointers and dynamic memory until you get use to it.

Reply With Quote
  #4  
Old June 14th, 2002, 07:03 PM
dmittner dmittner is offline
Dazed&Confused
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Tempe, AZ
Posts: 91 dmittner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 34 m 13 sec
Reputation Power: 7
Send a message via ICQ to dmittner Send a message via AIM to dmittner
Thanks for the input so far. I know the atleast the basics of C, having self taught myself a good portion of it. I can get by with memory and such, but fall behind when it comes to sophisticated memory management and dealing with a lot of information on a system with multiple, simultanious users. I'm pretty much stuck with being able to do moderately difficult changes and although I can think of some nice things to add, it's frustrating when my skills don't permit it.

As for Perl, I program that for a living so could overcome most challenges much easier. I guess I feel old age creeping up on me because I'm not learning things as quickly as I use to.

Reply With Quote
  #5  
Old June 14th, 2002, 07:13 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
We are in reverse rolls to a point. A program in C/C++(plus a few others) for a living, but nothing to do with games. Most of my apps deal with wireless terminal barcode scanners and inventory management. I have to deal with a massive amount of data between the terminals and a DB2 database (mysql comes no where close to offering the things I needed for this) so I deal a lot with memory and data transfer.

As I said before though, I would try Perl first, since you know that language best.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Perl vs. C/C++


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway