Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Perl python - regex performance comparison

Reply
Thread Tools

Perl python - regex performance comparison

 
 
Ivan
Guest
Posts: n/a
 
      03-03-2009
Hello everyone,

I know this is not a direct python question, forgive me for that, but
maybe some of you will still be able to help me. I've been told that
for my application it would be best to learn a scripting language, so
I looked around and found perl and python to be the nice. Their syntax
and "way" is not similar, though.
So, I was wondering, could any of you please elaborate on the
following, as to ease my dilemma:

1. Although it is all relatively similar, there are differences
between regexes of these two. Which do you believe is the more
powerful variant (maybe an example) ?

2. They are both interpreted languages, and I can't really be sure how
they measure in speed. In your opinion, for handling large files,
which is better ?
(I'm processing files of numerical data of several hundred mb - let's
say 200mb - how would python handle file of such size ? As compared to
perl ?)

3. This last one is somewhat subjective, but what do you think, in the
future, which will be more useful. Which, in your (humble) opinion
"has a future" ?

Thank you for all the info you can spare, and expecially grateful for
the time in doing so.
-- Ivan


p.s. Having some trouble posting this. If you see it come out several
times, please ignore the copies.
 
Reply With Quote
 
 
 
 
pruebauno@latinmail.com
Guest
Posts: n/a
 
      03-03-2009
On Mar 3, 12:38*pm, Ivan <ivan@@gmail.com> wrote:
> Hello everyone,
>
> I know this is not a direct python question, forgive me for that, but
> maybe some of you will still be able to help me. I've been told that
> for my application it would be best to learn a scripting language, so
> I looked around and found perl and python to be the nice. Their syntax
> and "way" is not similar, though.
> So, I was wondering, could any of you please elaborate on the
> following, as to ease my dilemma:
>
> 1. Although it is all relatively similar, there are differences
> between regexes of these two. Which do you believe is the more
> powerful variant (maybe an example) ?
>
> 2. They are both interpreted languages, and I can't really be sure how
> they measure in speed. In your opinion, for handling large files,
> which is better ?
> (I'm processing files of numerical data of several hundred mb - let's
> say 200mb - how would python handle file of such size ? As compared to
> perl ?)
>
> 3. This last one is somewhat subjective, but what do you think, in the
> future, which will be more useful. Which, in your (humble) opinion
> "has a future" ?
>
> Thank you for all the info you can spare, and expecially grateful for
> the time in doing so.
> -- Ivan
>
> p.s. Having some trouble posting this. If you see it come out several
> times, please ignore the copies.


1. They are so similar that, unless they added a lot in Perl lately,
both are about equally powerful. I think the difference had mainly to
do with how certain multiline constructs were handled. But that
doesn't make one more powerful than the other, it just means that you
have to make minor changes to port regexes from one to the other.

2. Speed is pretty similar too, Perl probably has a more optimized
regex engine because regexes are usually used a more in Perl programs.
Python probably has more optimized function calls, string methods,
etc. So it probably depends on the mix of functionality you are using.

3. Both languages have been around for a while and too much
infrastructure depends on them that they are not going to go away.
Perl is extensively used for sysadmin tasks, nagios, etc. and Python
is used in Gentoo, Redhat distributions. Of course COBOL is not dying
quickly either for the same reason which isn't the same than wanting
to program in it.

On this list you will find quite a few that have switched from Perl to
Python because we like the later better, but there are many
programmers that are quite happy with Perl. I myself want to play
around with Perl 6 at some point just for fun. Since a lot of the
reasons to choose one or another seem to be mostly syntax, I would
recommend you to write a couple of short programs in both of them and
see what you like more and use that.
 
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
Perl-python regex-performance comparison Ivan Python 5 03-03-2009 10:17 PM
Perl / python regex / performance comparison Ivan Python 2 03-03-2009 09:51 PM
Perl-python regex-performance comparison Ivan Python 0 03-03-2009 05:28 PM
How make regex that means "contains regex#1 but NOT regex#2" ?? seberino@spawar.navy.mil Python 3 07-01-2008 03:06 PM
perl regex to java regex Rick Venter Java 5 11-06-2003 10:55 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