Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python vs. Perl vs. PHP?

Reply
Thread Tools

Python vs. Perl vs. PHP?

 
 
Fazer
Guest
Posts: n/a
 
      07-28-2003
Hello,

I am an avid user of PHP and I am just fooling around with Python for
now. I originally wanted to know which one is faster. As in, works
faster. So far, I think PHP is the fastest for dynamic web-content.
Am I wrong?
 
Reply With Quote
 
 
 
 
Wilk
Guest
Posts: n/a
 
      07-28-2003
(Fazer) writes:

> Hello,
>
> I am an avid user of PHP and I am just fooling around with Python for
> now. I originally wanted to know which one is faster. As in, works
> faster. So far, I think PHP is the fastest for dynamic web-content.
> Am I wrong?


yes for two reasons, one relative, one more objective :

- you'll write cleaner and shorter programs with python, so more easy to
optimize
- when you'll really need speed, you'll write standalone web-server with
python, and so a lot more eficient and fast in high trafic.

I've rewrite my "high" trafic web site from php to python and gain 10x of
speed.

--
William Dode - http://flibuste.net
 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      07-28-2003
Fazer wrote:

> Hello,
>
> I am an avid user of PHP and I am just fooling around with Python for
> now. I originally wanted to know which one is faster. As in, works
> faster. So far, I think PHP is the fastest for dynamic web-content.
> Am I wrong?


Definitely. See here:

http://www.bagley.org/~doug/shootout/craps.shtml

Python is place 13, with a speed index of 578. PHP is second last (before
bash) and has a speed index of 197.

Besides that, PHP is a really ugly language - not only to the eye (which is
admittedly a matter of taste), but a friend of mine currently implements a
PHP->C-Compiler had delved deep into the language implementation - and it
_is_ ugly.

I expirienced mayor flaws in PHP 4.0.x, where my declared functions in a
6000 line include vanished from time to time - repeating the request
sometimes solved the problem. That was really nasty.

Regards,

Diez
 
Reply With Quote
 
Wilk
Guest
Posts: n/a
 
      07-28-2003
"Diez B. Roggisch" <> writes:

> Fazer wrote:
>
>> Hello,
>>
>> I am an avid user of PHP and I am just fooling around with Python for
>> now. I originally wanted to know which one is faster. As in, works
>> faster. So far, I think PHP is the fastest for dynamic web-content.
>> Am I wrong?

>
> Definitely. See here:
>
> http://www.bagley.org/~doug/shootout/craps.shtml


has somebody tried to run this bench with python2.3 ?

--
William Dode - http://flibuste.net
 
Reply With Quote
 
Fazer
Guest
Posts: n/a
 
      07-29-2003
"Diez B. Roggisch" <> wrote in message news:<bg3qkk$lmr$05$>...
> Fazer wrote:
>
> > Hello,
> >
> > I am an avid user of PHP and I am just fooling around with Python for
> > now. I originally wanted to know which one is faster. As in, works
> > faster. So far, I think PHP is the fastest for dynamic web-content.
> > Am I wrong?

>
> Definitely. See here:
>
> http://www.bagley.org/~doug/shootout/craps.shtml
>
> Python is place 13, with a speed index of 578. PHP is second last (before
> bash) and has a speed index of 197.
>
> Besides that, PHP is a really ugly language - not only to the eye (which is
> admittedly a matter of taste), but a friend of mine currently implements a
> PHP->C-Compiler had delved deep into the language implementation - and it
> _is_ ugly.
>
> I expirienced mayor flaws in PHP 4.0.x, where my declared functions in a
> 6000 line include vanished from time to time - repeating the request
> sometimes solved the problem. That was really nasty.
>
> Regards,
>
> Diez


Wow, thanks for link! I will use it as hard proof to lure some of my
friends in using Python!

This is a little off-topic, but I wish to know how would you turn a
string (or data from a text-file) into an array? For example, maybe
turn each \n into an array.

So a string like:

"This is line 1
This is line 2
This is line 3"

And so when you read that into a list called text text[0] would the
"This is line 1".

Thank you once again.
 
Reply With Quote
 
Fazer
Guest
Posts: n/a
 
      07-29-2003
Nevermind. I RTFM .
 
Reply With Quote
 
Aahz
Guest
Posts: n/a
 
      07-29-2003
In article < >,
Fazer <> wrote:
>
>This is a little off-topic, but I wish to know how would you turn a
>string (or data from a text-file) into an array? For example, maybe
>turn each \n into an array.
>
>So a string like:
>
>"This is line 1
>This is line 2
>This is line 3"
>
>And so when you read that into a list called text text[0] would the
>"This is line 1".


s.split('\n')
--
Aahz () <*> http://www.pythoncraft.com/

This is Python. We don't care much about theory, except where it intersects
with useful practice. --Aahz
 
Reply With Quote
 
Graham Breed
Guest
Posts: n/a
 
      07-30-2003
Diez B. Roggisch wrote:

> http://www.bagley.org/~doug/shootout/craps.shtml
>
> Python is place 13, with a speed index of 578. PHP is second last (before
> bash) and has a speed index of 197.


Those benchmarks are doubly useless for the question at hand. Firstly,
they only test command line applications. Secondly, PHP is compiled
without optimizations because the rules state that only the default
configuration can be used. See question 8 of the FAQ:

http://www.bagley.org/~doug/shootout/faq.shtml


Graham

 
Reply With Quote
 
=?ISO-8859-1?Q?Gerhard_H=E4ring?=
Guest
Posts: n/a
 
      07-31-2003
Fazer wrote:
> [...] I am basically looking for a FAST
> alternative to PHP meaning the responce time is fast. Do you think
> that Python with using the CGI module is a good solution?


No, CGI is not a good solution in this case, no matter what the language
(except those perverts who use something like C with dietlibc for this).

The base technology to make web requests fast in Python is something
like mod_python or a Python application server. On top of this I'd
recommend you use a Python web framework, of which there are numerous
ones. The hard part is to evaluate them and choose one.

FWIW I'm currently using Quixote running with mod_scgi against Apache,
mostly because I was fed up with the (lack of) Webware documentation,
which I tried first.

-- Gerhard

 
Reply With Quote
 
Fazer
Guest
Posts: n/a
 
      07-31-2003
Gerhard Häring <> wrote in message news:<mailman.1059640670.9792.python->...
> Fazer wrote:
> > [...] I am basically looking for a FAST
> > alternative to PHP meaning the responce time is fast. Do you think
> > that Python with using the CGI module is a good solution?

>
> No, CGI is not a good solution in this case, no matter what the language
> (except those perverts who use something like C with dietlibc for this).
>
> The base technology to make web requests fast in Python is something
> like mod_python or a Python application server. On top of this I'd
> recommend you use a Python web framework, of which there are numerous
> ones. The hard part is to evaluate them and choose one.
>
> FWIW I'm currently using Quixote running with mod_scgi against Apache,
> mostly because I was fed up with the (lack of) Webware documentation,
> which I tried first.
>
> -- Gerhard



Thanks for the reply! I think I am going to give mod_python a try.
Would I have to be root to install mod_python? Because that's one of
my biggest concerns. I don't have root and I don't want to work on my
windows machine since I am kind of more comfortable working on a Linux
platform.

Basically, most of my Python scripts would just be accessing the MySQL
database and just printing out various data.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? PerlFAQ Server Perl Misc 0 04-04-2011 10:00 PM
FAQ 1.4 What are Perl 4, Perl 5, or Perl 6? PerlFAQ Server Perl Misc 0 02-27-2011 11:00 PM
FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? PerlFAQ Server Perl Misc 0 02-03-2011 11:00 AM
FAQ 1.4 What are Perl 4, Perl 5, or Perl 6? PerlFAQ Server Perl Misc 0 01-23-2011 05:00 AM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57