473,836 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4527
"Tony Marston" <to**@NOSPAM.de mon.co.uk> wrote in
"John Bokma" <po********@cas tleamber.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********@cas tleamber.com> wrote in message news:<Xn******* *************** ***@130.133.1.4 >...
or************@ gmail.com (Brad Shinoda) wrote in
news:ad******** *************** ***@posting.goo gle.com:
John Bokma <po********@cas tleamber.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. Misunderstandin g 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.goo gle.com:
John Bokma <po********@cas tleamber.com> wrote in message
news:<Xn******* *************** ***@130.133.1.4 >...
or************@ gmail.com (Brad Shinoda) wrote in
news:ad******** *************** ***@posting.goo gle.com:
> John Bokma <po********@cas tleamber.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. Misunderstandin g 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_positiv e_integers( $a, $b )
negative_intege r_add_positive_ integer( $a, $b )
addnegativeinte gers( $a, $b )
get_sumof_posit iveandnegative_ 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*******@inwa p.com> wrote in news:2uw7d.9605 2$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
9906
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
1458
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 wait 10-50% longer...
2
1765
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 times slower than a Perl equivalent on a large input (~212 Mb). There has to be something wrong - can anyone help me fix it? I've included both at the bottom of my post and I compile with g++ -03 cin_test.C Thanks!
47
3466
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): row+="a"
0
9825
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9673
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10859
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10560
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9388
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6984
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4463
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.