[23354] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5573 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 27 03:05:53 2003

Date: Sat, 27 Sep 2003 00:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 27 Sep 2003     Volume: 10 Number: 5573

Today's topics:
    Re: add half an hour to all times in file <jidanni@jidanni.org>
    Re: dim <REMOVEsdnCAPS@comcast.net>
    Re: Explaining how a (Mind) program works <REMOVEsdnCAPS@comcast.net>
    Re: Find what is in array1 and not in array2 <REMOVEsdnCAPS@comcast.net>
        How to test speed difference of Perl/Apache and SSI/Apa (The Poor)
    Re: How to test speed difference of Perl/Apache and SSI <REMOVEsdnCAPS@comcast.net>
    Re: packages <dha@panix.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 26 Sep 2003 11:37:10 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: Re: add half an hour to all times in file
Message-Id: <87brt8kyop.fsf@jidanni.org>

[Couldn't reply to Mr. Walton's spam protected address, even after
decoding. See http://jidanni.org/comp/spam/ ]

Bob> use Date::Manip;

Thanks.  Say, should the Date::Parse perldoc page say 'SEE ALSO
Date::Parse' on it, or is that unix practice not common perl practice?


------------------------------

Date: Sat, 27 Sep 2003 01:19:28 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: dim
Message-Id: <Xns9403178932193sdn.comcast@206.127.4.25>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

"Jürgen Exner" <jurgenex@hotmail.com> wrote in
news:xf_cb.11207$Wd7.6576@nwrddc03.gnilink.net: 

> Untested, only a sketch. Adding error checking is left as an
> excercise: 
> 
> my @greplist=qw( var full error over repeats no_space );
> my @all;
> 
> open F, '/var/adm/syslog';
> while (<F>) { #we go through the file only once, line by line
>     for ($word = @greplist){ #in each line we check for every word

You mean

      foreach my $word (@greplist) {

of course.


I'm not sure, but I suspect it'd be faster to do:

      my $pat = join '|', @greplist;  # at top of program
      push @all, $_  if /$pat/i;      # within file loop

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP3UrxWPeouIeTNHoEQID0wCaAphvaYQSoGLLIOzYbczPDt+tZogAoOtD
2euRjjxBVuZJ+FS0kXWmbhyb
=O8Re
-----END PGP SIGNATURE-----


------------------------------

Date: Sat, 27 Sep 2003 01:21:15 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Explaining how a (Mind) program works
Message-Id: <Xns940317D70820sdn.comcast@206.127.4.25>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

uj797@victoria.tc.ca (Arthur T. Murray) wrote in
news:3f7487d7@news.victoria.tc.ca: 

> 
> A.T. Murray

Art, Art, Art, Art....  How is this remotely relevant to 
comp.lang.perl.misc?

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP3UsM2PeouIeTNHoEQJJuQCg5sAB9e7BETgWJdzhSWLVCOZOj90AoOoi
OLp+ragOZQDn/LRsI8E32YNt
=9d+6
-----END PGP SIGNATURE-----


------------------------------

Date: Sat, 27 Sep 2003 01:12:30 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Find what is in array1 and not in array2
Message-Id: <Xns9403165ACDF6Esdn.comcast@206.127.4.25>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

a@job.mx.2y.net (The Poor) wrote in news:30bcc0c9.0309260752.1d1e44b9
@posting.google.com:

> But it is not what I need. I need to find what in array1, but not in
> array2. Can anyone show me how to do that?
> If I just juse array1-union, then should that be the what I need? What
> is the running time will be? 2(n+m)?
> Currently I am using 2 for loops to compare anything in 1 to anything
> in 2, that makes the running time n*m/2

Use a temporary hash:

my %temphash;
@temphash{@array1} = ();
delete @temphash{@array2};
my @in_1_but_not_in_2 = keys %temphash;

I'm not sure how to compute the runtime; my guess is that it'd be O(m+n).

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP3UqJGPeouIeTNHoEQI0UACfWiVqPsQjbTb0Npx4Ooh77WDPjWgAoKn7
wdc0/N6/KZqgMhpZBVDSVASO
=5BTn
-----END PGP SIGNATURE-----


------------------------------

Date: 26 Sep 2003 21:39:27 -0700
From: a@job.mx.2y.net (The Poor)
Subject: How to test speed difference of Perl/Apache and SSI/Apache
Message-Id: <30bcc0c9.0309262039.64792513@posting.google.com>

I am using SSI now and it can not include external things. I want to
use Perl/CGI to do that, but worried about slower speed. How do I
test/benchmark the different of loading on Perl/Apache and SSI/Apache.

in perl
open a file for read, print it, close file

in ssi
include the file

because the network speed vary much, how do i calculate the speed of
the perl vs ssi? i can easily open/read/print/close 100 times in perl,
but i can not do that in ssi to compare...

i know in perl open/write is not multithread. how about open/read. can
many perl instances open and read the same file? what is the max
number of perl programs open the same perl? what the list of
ssi?--same as the limit of apache?

In term of speed, what is the best choice? PHP/Apache,
Mod_Perl/Apache, Fast_cgi/Apache, standred Perl/Apache, C exe/Apache,
jsp/Apache?


------------------------------

Date: Sat, 27 Sep 2003 01:28:39 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: How to test speed difference of Perl/Apache and SSI/Apache
Message-Id: <Xns940319181E0D2sdn.comcast@206.127.4.25>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

a@job.mx.2y.net (The Poor) wrote in news:30bcc0c9.0309262039.64792513
@posting.google.com:

> In term of speed, what is the best choice? PHP/Apache,
> Mod_Perl/Apache, Fast_cgi/Apache, standred Perl/Apache, C exe/Apache,
> jsp/Apache?

I can't speak for PHP or JSP, having no experience with them.

C executable is probably the fastest of the other choices.  Bitch to write, 
though.  And you do have the overhead of forking a new process.

Standard CGI is by far the slowest.  By *FAR*.

FastCGI and mod_perl are much faster than standard perl CGI.  They are 
comparable in speed.  The relative speeds vary based on how well the 
programs are written, what functions they are actually performing, etc.  I 
believe that a well-written FastCGI program is a hair faster than a well-
written mod_perl program, all other things being equal -- but for most 
intents and purposes, it's a toss-up.

I personally find FastCGI programs easier to write and debug than mod_perl 
programs.  And FastCGI scales better, but that's only an issue if you have 
a humongous website that's serving hundreds of thousands of requests a day.

Faster still would be an Apache module written in C.  Those are a royal 
pain to write and debug, though.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP3Ut7GPeouIeTNHoEQLxUQCg9WC+FfFWRckNLbU7SWAM55GNzKsAoIwt
+WG834np3tSyKutPTo/0tLZ/
=MGtR
-----END PGP SIGNATURE-----


------------------------------

Date: Sat, 27 Sep 2003 06:21:53 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: packages
Message-Id: <slrnbnab41.8o0.dha@panix2.panix.com>

In article <tpa9nv89pqffuq1qtjq1dhcekgbj95qoom@4ax.com>, Bart Lateur wrote:
> Steve Grazzini wrote:
> 
>>Okay, this is not actually the case.  In fact, CGI says that it
>>doesn't use Exporter for reasons of "execution speed" -- but I 
>>still think it's better to be slow than incorrect, and that
>>Exporter is not really so slow, and that constantly reinventing
>>Exporter will eventually lead to *more* bloat, not less.
> 
> CGI.pm is accusing another, much smaller module than itself of bloat?!?
> *boggle* (10k for Exporter vs. >200k for CGI.pm)

I may be wrong as I'm working from memory here, but...

The point is that CGI.pm uses its own exporting system so as to minimize
what's actually exported - i.e. only what's actually used by your
program gets compiled.  I *believe* that Exporter wasn't as good for
this in this particular case.

Or I may be hallucinating.  *shrug*

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Now I don't speak any English, just American without tears.
        - Elvis Costello


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5573
***************************************


home help back first fref pref prev next nref lref last post