![]() |
| | #1 |
| Unregistered User Join Date: Jul 2007
Posts: 925
| is C++ or PHP the best option? Besides difficulty in coding, speaking strictly preformance, which would be better?
__________________ GCC 4.4.0, Code::Blocks 8.02, Fedora 11, x64 |
| Yarin is offline | |
| | #2 |
| Wheres the lesbians? Join Date: Oct 2006 Location: UK
Posts: 1,219
| Are you going to be using a database? If so, then thats usually where the bottleneck will end up. PHP should be fine, loads of very busy sites use it. And if speed was an issue I'd rather fork out for a faster server than spend all the extra time dealing with C++ for text processing. Obviously you could get better performance using C++, I just don't see the point for websites.
__________________ Senior highbrow doctor of authority. |
| mike_g is offline | |
| | #3 | |
| Registered User Join Date: Sep 2004 Location: California
Posts: 2,845
| Quote:
__________________ bit∙hub [bit-huhb] n. A source and destination for information. | |
| bithub is offline | |
| | #4 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,944
| Quote:
![]() If you already know perl and have not learned any php (I'm guess you don't know php, or you wouldn't bother asking) you may want to google "perl mason" which works under apache mod_perl. That means perl is kept loaded -- no need to launch a process -- and executes as fast as the underlying C code. Mason allows you to embedd perl in html templates -- the same way as php -- but even with plain ol' CGI, mod_perl itself increases the performance by something like 600-700%. Meaning apache will deal with 500+ requests per second constantly without slowing down* depending on the hardware it's running on. Actually, here's a test I just did on my eeny-meeny vps mod_perl server: Code: Concurrency Level: 10 Time taken for tests: 1.860 seconds Complete requests: 5000 Failed requests: 0 Write errors: 0 Total transferred: 1660000 bytes HTML transferred: 470000 bytes Requests per second: 2687.75 [#/sec] (mean) Time per request: 3.721 [ms] (mean) Time per request: 0.372 [ms] (mean, across all concurrent requests) Transfer rate: 871.42 [Kbytes/sec] received Code: #!/usr/bin/perl -w
my $r = shift;
$r->send_http_header('text/plain');
print "Hello world\n";
If you don't know either php or perl, php is more common for this and much easier to learn, methinks, but there are a lot of advantages to perl; eg, with my private chat server, qv. OMG! Live chat w/ MK27! the parallel server** is written in perl, but it can share modules with the embedded code in the html pages -- meaning 1) less memory usage 2) less code duplication (validation routines, etc). And best of all, you can save your brain for perl and forget php. FYI, Amazon.com uses perl mason instead of php. If you don't know either, and you just want to do a lot of typing, use C++. But I very much doubt the "bottlenecks" in a web server will be in anyway improved by using a complied app to generate the pages. *so I'm not sure what you mean by "high traffic", but I really really doubt this is an actual issue. Even a normal cgi setup should serve like 100 requests per second. ** by which I mean, not apache itself, but a persistant program that handles certain details (requiring persistance) in the background, then serves them up to apache. Sort of like how a dedicated database server might work if it were RAM based...
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS Last edited by MK27; 10-13-2009 at 10:48 AM. | |
| MK27 is offline | |
| | #5 |
| Unregistered User Join Date: Jul 2007
Posts: 925
| @MK27: Typo, I meant to say "got any good references to learning *perl* for web dev?". Sorry Can anyone here tell me what RonR is??
__________________ GCC 4.4.0, Code::Blocks 8.02, Fedora 11, x64 |
| Yarin is offline | |
| | #6 |
| Registered User Join Date: Nov 2007
Posts: 171
| Ruby on Rails It's just a fad.
__________________ I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo |
| NeonBlack is offline | |
| | #7 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,944
| "Ruby on Rails" is a system that allows you to use ruby in a php-like embedded fashion. I actually learned ruby just for that. My problem with RonR is that is exclusively a MVC arrangement -- I think ASP is also this way. There are a lot of good things about MVC, but IMO it makes many things easier, many other things unnecessarily complex (because even "hello world" uses a database ), and some things impossible or extremely awkward. In the course of learning RonR I found out about Mason, which is kind of a well kept secret or something -- eg, I could not find a short beginner tutorial on the web. So after I got the hang of it, while all my "beginner" type concerns were still fresh in my mind, I wrote one: TUTORIAL: Intro to Embedded Perl Using Mason There's also an online version of the 1st edition of an O'Reilly book ("Using Mason") that's linked in the tutorial. There is also Mason HQ: Welcome to Mason which most of my subsequent "How the heck..." searches seem to end up there. There's also a mailing list, which as long as I've been watching it, people seem to get quick help, <12 hrs. (BTW the tutorial got looked over and approved by the mailing list, which includes the developers) If you don't know perl tho, before you start seriously you would have to learn
I don't know why Mason is (apparently) so much less prevalent than php and RonR -- perhaps because most of the old school perl gurus just do everything with cgi. Since I've never used php much, I can't say with authority what's "better" but I think they are probably both about as flexible as you could want, within the constraints of how the web works. Which vis dynamic content, you have two places where the content is dynamized: Client side: code is downloaded and run on client, javascript, java applets, flash, css can be dynamic... You can't download a whole database and most people wouldn't want you to, so there's server-side; kind of "expensive" because the server has to do it. That's CGI (any language) and the server-side scripting languages, ASP, php, perl (there are several other ways besides mason), ruby, also PYTHON can be embedded via Django, but that too is strictly MVC (I believe). Definately php was invented for the web by a german academic, initially, just for himself. It stood for "personal home page" scripting, altho now it has a recursive joke acroymn...
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS Last edited by MK27; 10-14-2009 at 09:09 AM. |
| MK27 is offline | |
| | #8 |
| Registered User Join Date: Jul 2007
Posts: 44
| PHP: write web pages and some programs if you are insane and don't want to use any language which suits better for that job. Perl: write web pages, write anything else or just check CPAN, because the program you need is already written. Ruby on Rails: Does even /. use this? Last edited by fronty; 10-13-2009 at 01:07 PM. |
| fronty is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unknown memory leak with linked lists... | RaDeuX | C Programming | 6 | 12-07-2008 04:09 AM |
| My program isn't inserting a new node in the beginning of the list... | RaDeuX | C Programming | 3 | 12-06-2008 07:54 PM |
| PHP installation | ssharish2005 | Tech Board | 8 | 11-23-2007 09:42 PM |
| Binary Search Tree | penance | C Programming | 4 | 08-05-2005 05:35 PM |
| PHP on my Computer! | xxxrugby | Tech Board | 4 | 03-15-2005 09:34 AM |