473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is PHP still slower than Perl?

@
A benchmark in 2002 showed PHP is much slower in shell or when Apache has
Mod_Perl.

With the new PHP kissing Java's ass, Perl is once again the #1 CGI choice.

Java is for a big team in short time to develope something slow.

ASP is a joke.

PHP is a kid.

Perl is around.

C. I don't know why it is not popular. It should be. Maybe those Web
inventors always thought in Linux so they never wanted to push something
binary so they selected Perl, a slower scripting.
Jul 17 '05
58 4423
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in
"John Bokma" <po********@castleamber.com> wrote in message
[ snip ]
Imagine everybody writing wrapper functions all the time instead of
doing real work...


Image using the wrong wrapper function.


Yeah, I can. And I can even more imagine the same person writing his/her
own "software"...
Besides, even if you do write
your own wrapper function you only ever do so once. Then you re-use
it, and re-use it, and re-use it.
Yes, that is why there is CPAN. To re-use it. I understood that PHP has
something along these lines too.
If you want to screw something in the wall, do you make your own
custom screws or do you go to the hardware store?


If I want to fix something to a wall then a screw is not necessarily
the only method. What about a nail or even glue?


So you make your own nails, and brew you own glue. Probably dig your own
metal, and herd your own cows.
There are different
possible fixings for different types of wall, so just because someone
has invented one type of fixing does mean that it is the only type of
fixing.
And hence, CPAN doesn't have one module called Screw.pm
I have stopped using other people's solutions for the following
reasons: (a) There are too many solutions from too many people. The
people have various skill levels (from pathetic to passable), and
the solutions are tailored for specific purposes.


With PHP, Perl or in general?


With PHP, UNIFACE, COBOL and a few other languages I have used in the
past. I don't touch perl.


That sounds like "I don't use glue, ever! Because I have experience with
nails and screws, and hey, I make them myself"
I use my decades of experience to select a library or module, or
consult the right people. It has always saved me a lot of time and
trouble.


When there are thousands of competing libraries out there,


Sure, there are thousands of competing modules on CPAN...
There are in total 7057 modules ( 2004-10-07, http://cpan.org/ )
You really think that are 7057 similar and competing libraries?
how do I know which is the right one?
Little research, asking. Some modules come with the "core" distribution
of Perl. And sometimes you learn some new ones. Staying in touch with
the languages you use is always important. You can't learn a language
and it's important libraries in a weekend.
Should I spend weeks looking and
comparing, or days in writing my own?
Yep, days writing your own, and tweaking for each new project, bug
fixing, and testing backwards compability. The looking needs only to be
done once. Or you write the perfect library from scratch?
Who are the "right people"?
Read usenet, you learn fast. Also some right people in the Perl group
recommend modules now and then.
I have come across too many people who
class themselves as "experts" who turn out to be charlatans and
quacks.


Yeah ;-)

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #51
John Bokma <po********@castleamber.com> wrote in message news:<Xn*************************@130.133.1.4>...
or************@gmail.com (Brad Shinoda) wrote in
news:ad**************************@posting.google.c om:
John Bokma <po********@castleamber.com> wrote in message
news:<Xn*************************@130.133.1.4>...
That's mySQL, not PHP.

I mean something like:

$query = "INSERT INTO table VALUES(?, ?, ?)";
mysql_bla( $query, $a, $b, $c );

Hence without the quote_she_bang_garbage
I can't believe you can't actually write such a function yourself???


Sure. I can even write my own improved PHP clone. What's the point?


You're the one who wants the functionality. That's what the "point"
is.
People should always be writing wrapper functions or classes to handle
db connections, to remove such stuff as addslashes()ing. Use
func_num_args() to find out the number of arguments passed to a php
function and func_get_arg([number]) to get the [number]th argument
passed. I've written such a function for myself.
Yes, and everybody has to write wrapper functions. You get the point
now, or do you want it spelled out?


I see what you mean, you're saying that you'd rather it be
incorporated into the language rather than something you have to do
yourself. Misunderstanding on my part.
Well in fact I use
three classes for handling databases - one abstract "Database" class
for any database,
Yes, in Perl that is called DBI. You don't have to write it yourself.

one Database specific class (eg mysql_db for mysql
databases) and a Query class for handling queries in the manner you
suggest. Now I do this:

$sql = "SELECT foo, bar
FROM table
WHERE a = ?
AND b = ?";
$db->query(new Query($sql, $a, $b), __LINE__, __FILE__);

And all query preprocessing is handled by the Query class, and
database connection/query processing/error handling is handled by the
database-specific class.

I use such classes in all my developments. They're written once then
forgotten about, and simply reused where needed.


Wonderful. With Perl it's put on CPAN and used (and tested) by many
people.


I dunno what CPAN is but I'll assume it's some kind of equivilant to
PEAR?
All I'm saying is that it's really pretty easy to implement many
things yourself, without moaning that the language hasn't done them
for you.


Programming shouldn't be about reinventing wheels, and worse reinventing
bugs.


I suppose, but at the same time doing it yourself gives you more
control, and more scope for customisability.
Jul 17 '05 #52
or************@gmail.com (Brad Shinoda) wrote in
news:ad**************************@posting.google.c om:
John Bokma <po********@castleamber.com> wrote in message
news:<Xn*************************@130.133.1.4>...
or************@gmail.com (Brad Shinoda) wrote in
news:ad**************************@posting.google.c om:
> John Bokma <po********@castleamber.com> wrote in message
> news:<Xn*************************@130.133.1.4>...
>> That's mySQL, not PHP.
>>
>> I mean something like:
>>
>> $query = "INSERT INTO table VALUES(?, ?, ?)";
>> mysql_bla( $query, $a, $b, $c );
>>
>> Hence without the quote_she_bang_garbage
>
> I can't believe you can't actually write such a function
> yourself???
Sure. I can even write my own improved PHP clone. What's the point?


You're the one who wants the functionality. That's what the "point"
is.


No, I want less garbage, and less error prone code, *that's* the point.
Yes, and everybody has to write wrapper functions. You get the point
now, or do you want it spelled out?


I see what you mean, you're saying that you'd rather it be
incorporated into the language rather


Nooooo... please don't incorporate more functions in the language. By
know PHP must be the language with the biggest function clutter *in* the
language, combined with the worst naming scheme (or lack of) ever.
than something you have to do
yourself. Misunderstanding on my part.


Have a look at DBI, or JDBC. It's not that difficult to understand what
I mean. Once you understand the basics, you get my point ;-)
Wonderful. With Perl it's put on CPAN and used (and tested) by many
people.


I dunno what CPAN is but I'll assume it's some kind of equivilant to
PEAR?


It's most likely the other way around. And I am afraid PEAR doesn't come
close to CPAN.
Programming shouldn't be about reinventing wheels, and worse
reinventing bugs.


I suppose, but at the same time doing it yourself gives you more
control, and more scope for customisability.


What do you want to customise about prepared statements? It's like
saying, let's not include geometrical functions, but let's write them
ourselves, so we can customise them...

Everytime I look at PHP I am afraid to discover one day that + has been
replaced with

add_two_positive_integers( $a, $b )
negative_integer_add_positive_integer( $a, $b )
addnegativeintegers( $a, $b )
get_sumof_positiveandnegative_integer( $a, $b )
integer_add( $a, $a_is_positive, $b, $b_is_positive )
:
:
:-)

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #53
Brad Shinoda wrote:
I dunno what CPAN is but I'll assume it's some kind of equivilant to
PEAR?


CPAN is a huge repository of prebuilt and reusable packages. I think I saw
someone mention that there's currently about 7000 packages available. So it
is sort of the equivilent of PEAR, but PEAR's still in its infancy compared
to CPAN and many PHP developers don't seem to know about it.

One difference between this aspect of Perl vs PHP (and I'm speaking here as
someone who used to develop Perl about 6 years ago and then switched to
PHP) is that all the Perl developers seem to know about CPAN and it sounds
like it's easy to contribute to, whereas the reverse seems to be true for
PHP.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #54
Joe Smith <Jo*******@inwap.com> wrote in news:2uw7d.96052$wV.30196
@attbi_s54:
@ wrote:
C. I don't know why it is not popular.


I'd say it is because C does not have strings as a native data type.
Other than initializing an array of char, the C compiler has no
string manipulation built in; it requires library functions to do that.
-Joe


I'm surprised that there aren't any open-source CGI libraries out there for
doing things like parsing CGI variables, getting/setting cookies, etc.

Every now and then, I think of writing one, but I hardly use C any more....

--
Eric
`$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=(
$!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++;
$_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~,$#,);$,++
;$,++;$^|=$";`$_$\$,$/$:$;$~$*$%[$?]$.$~$*${#}$%[$?]$;$\$"$^$~$*.>&$=`
Jul 17 '05 #55
On Sat, 9 Oct 2004, Eric J. Roode wrote:
I'd say it is because C does not have strings as a native data type.
Other than initializing an array of char, the C compiler has no
string manipulation built in; it requires library functions to do that.
-Joe


I'm surprised that there aren't any open-source CGI libraries out there for
doing things like parsing CGI variables, getting/setting cookies, etc.


Do you mean libraries like GCGI (http://catchen.org/gcgi/)?

Jason Clifford
--
UKFSN.ORG Finance Free Software while you surf the 'net
http://www.ukfsn.org/ ADSL Broadband from just £21.50 / month

Jul 17 '05 #56
Tassilo v. Parseval a écrit :
Also sprach Joe Smith:

@ wrote:

C. I don't know why it is not popular.
I'd say it is because C does not have strings as a native data type.
Other than initializing an array of char, the C compiler has no
string manipulation built in; it requires library functions to do that.

That's a distinction in C that's moot. It has no built-in IO mechanisms
either. You have to include a header to get this functionality.


Including the header won't do much more than having correct
prototypes... You can also put the proto by yourself, it's just more
error prone.
But
nonestheless, it's still part of the language.


Of the ANSI/ISO standard, not of the core language. I/O are not builtin
constructs of the language, nor part of the language grammar. You don't
have to care about I/O when writing a C compiler. You can write a C
implementation without I/O, it won't of course be ISO/ANSI compliant but
still be legal and unmodified C syntax.

Bruno
Jul 17 '05 #57
This kind of garbage shouldn't be here. I never understood the my
language is better than your language crap. This is a PHP Newsgroup, if
you idolize Perl so much, go join their newsgroup, but I am pretty sure
"omg perl rawks my world" would be equally unwanted there as it is
here.

Who cares what language you prefer to use as your CGI Gateway, they all
essentially serve a purpose, although that purpose may be similar to
another language's.

Really, this doesn't belong here, and I honeslty don't think anyone
here is out to conquer a whole market. Besides perhaps the original
poster.

Jul 17 '05 #58
Simon Stienen <si***********@news.slashlife.de> writes:

[...]
Please explain the difference between safety and security.
Security is against hostile attackers, safety is against the code
screwing up. Because of C's nature your forced to use pointers all
over the place, and because C lacks a Garbage Collector its quite easy
to free memory, that you later on attempt to use. This causes a
sementation fault (or worse), and the code crashes.

So called scriting lanagues and functional lanaguges get past this
limiation by having a garbage collector and systems that mean pointer
equiverlents are safe.
If you've done this:
*What* is bad about header files and the preprocessor?
Because the preprocessor works purly as text substitution, because it
isn't realy part of the language it can screw up things up in hideous
ways. For example header files don't impose any sort of namespaceing
so its quite possable to have name space collisions between diffrent
sets of included libaries.

[...]
By now, your whole post shouts:
"I don't have a clue about C, so it *has* to be bad."


I've programed extensivly in C, and I know how bad it is.
--
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
Jul 17 '05 #59

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
5
by: Michael | last post by:
i experience slower compile times with VC++ 2003 compared to VC+6.0. Anyone experiencing the same? Should that be expected? This ineed matters, when total compilation time is > 1h and you have to...
2
by: jeffrey.bigham | last post by:
Hello, I'm writing a program that needs to read input line by line and analyze each, and it needs to be as efficient as possible. I wrote the following sample program that works, but is 10...
47
by: Henning_Thornblad | last post by:
What can be the cause of the large difference between re.search and grep? This script takes about 5 min to run on my computer: #!/usr/bin/env python import re row="" for a in range(156000):...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.