[8500] in Perl-Users-Digest
Perl-Users Digest, Issue: 2118 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 17 14:08:14 1998
Date: Tue, 17 Mar 98 11:02:15 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 17 Mar 1998 Volume: 8 Number: 2118
Today's topics:
Performance Expectations <peduel@ironbridgenetworks.com>
Re: Performance Expectations <khuber@yuck.net>
Re: Performance Expectations (Ilya Zakharevich)
Re: Perl for WIN32 external system calls <jdporter@min.net>
Re: Perl for WIN32 external system calls <jdporter@min.net>
Re: Perl system() calls on NT w/IIS <tom@imagic.be>
Perl5 compile error ByrneJB@Harte-Lyne.ca
Re: perl5_00402 needs > 50MB on my Win95 system:-( Any schwern@starmedia.net
redirect stderr and stdout to the same file ()
Re: searching a file in Perl (Paul Wilson)
Re: Sendmail and Mime. <quentin@jihad.amd.com>
Re: Telnet control codes, stumped! (Jason Gloudon)
Re: Telnet control codes, stumped! schwern@starmedia.net
Re: Using regex to initial cap a name <mps@shellus.com>
Webget and Win95 <cjlf@netcom.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 17 Mar 1998 11:14:49 -0500
From: Yuval Peduel <peduel@ironbridgenetworks.com>
Subject: Performance Expectations
Message-Id: <350EA179.A1C74A51@ironbridgenetworks.com>
I recently wrote a program that took far longer than I had expected. I
used the DProf tool to track down where the time was being taken. Most
of it was in a routine like the following:
sub test {
my ($a, $b) = @_;
my $c = $a & $mask[$b];
my $result = $lookup[$c];
return $result;
}
I then used Benchmark to get some times on this routine in isolation,
just to confirm the profiling results. Executing this routine one
million times on a Sun Ultra 2 took approximately 19 seconds of CPU
time. This seems inordinately high. I'm perfectly willing to accept a
50X performance hit relative to C in order to get the benefits of faster
and easier development, but this is worse than that. (I get 8.2 seconds
for one hundred million executions of the corresponding C routine (no
optimization) which is a 230X performance hit.)
Am I missing something obvious or are my expectations too high?
Where do I go from here? Implementing the function in C sounds obvious,
but most of the time (about 2/3) is actually going to the subroutine
invocation. Here is the program I was using for the timing tests:
#!/usr/local/bin/perl -w
#
use integer;
use strict;
use Benchmark;
use vars qw(@mask @lookup $ga $gb);
$mask[0] = 0;
$lookup[0] = 0;
$ga = 0;
$gb = 0;
timethese(1000000,{ call => 'test(0,0)',
in_line => '{ my $c = $ga & $mask[$gb];
my $result = $lookup[$c];
}'});
exit (0);
Note that I am using integer to avoid floating point overhead; all my
data is indeed integer, so I should not be seeing much in the way of
string to integer conversion; etc.
Any ideas will be greatly appreciated.
TIA.
------------------------------
Date: Tue, 17 Mar 1998 17:12:39 GMT
From: Kevin Huber <khuber@yuck.net>
Subject: Re: Performance Expectations
Message-Id: <uj2k99tdywp.fsf@bambi.visi.com>
Yuval> I recently wrote a program that took far longer than I had
Yuval> expected. I used the DProf tool to track down where the time
Yuval> was being taken. Most of it was in a routine like the
Yuval> following:
Why not something like:
sub test {
return $lookup[$_[0] & $mask[$_[1]]];
}
I measured a 2x performance increase, just need that other 100x now
;-).
It's hard to say what you should expect -- maybe you need to rethink
your design. Is the C performance level really necessary? I ask
because I don't know what you're trying to do, if this must run
frequently, etc.
-Kevin
------------------------------
Date: 17 Mar 1998 18:01:21 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Performance Expectations
Message-Id: <6emdph$r46$2@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Yuval Peduel
<peduel@ironbridgenetworks.com>],
who wrote in article <350EA179.A1C74A51@ironbridgenetworks.com>:
> I recently wrote a program that took far longer than I had expected. I
> used the DProf tool to track down where the time was being taken. Most
> of it was in a routine like the following:
>
> sub test {
> my ($a, $b) = @_;
> my $c = $a & $mask[$b];
> my $result = $lookup[$c];
> return $result;
> }
>
> I then used Benchmark to get some times on this routine in isolation,
> just to confirm the profiling results. Executing this routine one
> million times on a Sun Ultra 2 took approximately 19 seconds of CPU
> time. This seems inordinately high. I'm perfectly willing to accept a
> 50X performance hit relative to C in order to get the benefits of faster
> and easier development, but this is worse than that. (I get 8.2 seconds
> for one hundred million executions of the corresponding C routine (no
> optimization) which is a 230X performance hit.)
200 times is OK for things which are easy in C. This is what
independent ways to benchmark consistently show.
Perl compile tree walker is not very quick. :-(
Ilya
------------------------------
Date: Tue, 17 Mar 1998 11:06:19 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Perl for WIN32 external system calls
Message-Id: <350E9F7B.57AD@min.net>
John Porter wrote:
>
> James Ludlow wrote:
> >
> > The biggest problem is that you actually need to use a double
> > backslash "\\".
> >
> > system ("c:\\pkware\\pkunzip.exe $currfile");
>
> You gotta backwhack backwhacks if you gottem, but it is far
> better -- portable and less error-prone -- to lose the
> backwhacks and use forward slashes.
> As has been said numerous times, "Backwhacks are wack, jack.".
>
> DOS/Win/NT is quite happy with slashes; only the brain-dead
> command interpreter from M$ barfs on them.
Which, by the way, means you need them for commands passed to
the system() function, as in James' original question.
Sorry 'bout the tangential rant...
John Porter
------------------------------
Date: Tue, 17 Mar 1998 11:09:42 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Perl for WIN32 external system calls
Message-Id: <350EA046.2E43@min.net>
John Porter wrote:
>
> > DOS/Win/NT is quite happy with slashes; only the brain-dead
> > command interpreter from M$ barfs on them.
>
> Which, by the way, means you need them for commands passed to
> the system() function, as in James' original question.
Kinda sorta. Is everyone straightened out on this yet?
------------------------------
Date: Tue, 17 Mar 1998 17:51:56 +0100
From: "Tom Adriaenssen" <tom@imagic.be>
Subject: Re: Perl system() calls on NT w/IIS
Message-Id: <6em9nk$cb2$1@krypton.inbe.net>
Charlie Hatton wrote in message <350E9A65.D7BF4890@dfdis.com>...
>I'm having a problem getting Perl system() calls to return output on NT
>4.0 using IIS. I can run my scripts from the command line and get
>appropriate output, but nothing using a WWW browser. Other Perl
>functions appear to be fine, including some DBI/DBD add-on modules.
>Below are details; any help posted here or sent to me @ hatton@dfdis.com
>would be *greatly* appreciated. Thanks in advance!
Yeah, i've got the same problem. We were using Perl 5.003 (ActiveState) on
our server (NT4, SP3, IIS4). Needing to upgrade perl to 5.004 (because 5.003
choked on prog 'A'), i downed the Standard binary perl implementation
(5.004_02), installed it.
Prog A works fine, but a prog B that uses system( '' ) calls to another perl
script fails now.
Restoring the old perl stuff reinstates prog B but then prog A won't work.
Our configuration is about the same as the one specified by Charlie.
Help greatly appreciated.
------------------------------
Date: Tue, 17 Mar 1998 10:24:57 -0600
From: ByrneJB@Harte-Lyne.ca
To: Kym Oberauer <kym@empire.com.au>
Subject: Perl5 compile error
Message-Id: <6em814$i5l$1@nnrp1.dejanews.com>
I am trying (vainly) to get perl5.004_04 to build on HP-UX 11.00 using gcc
2.8.1. I am getting this error towards the end of the make file.
AutoSplitting perl library
AutoSplitting Text::ParseWords (lib/auto/Text/ParseWords)
sh: 151 Memory fault(coredump)
*** Error exit code 139
This is very similar to an error posted to this news group in April of 1997
and reproduced herein.
Subject: Perl5 compile error
From: Kym Oberauer <kym@empire.com.au>
Date: 1997/04/29
Message-ID: <33658744.7564@empire.com.au>
Newsgroups: comp.lang.perl.misc
Hmmmm..
Ive been asked to install perl5 on our NextStep 3.2 system running on a
68k. Now ive given this a go a few times using the default settings keep
getting errors like this:
-------------------------------
AutoSplitting perl library
AutoSplitting Text::ParseWords (lib/auto/Text/ParseWords)
./miniperl minimod.pl > tmp && mv tmp lib/ExtUtils/Miniperl.pm
`sh cflags libperl.a perlmain.o` perlmain.c
CCCMD = cc -c -DDEBUGGING
Making DynaLoader (static)
Writing Makefile for DynaLoader
sh: 25804 Memory fault
*** Exit 139
Stop.
*** Exit 1
Stop.
-------------------------------
Any ideas would be appreciated.
There appear to be no follow up posts to this message. Does anyone know what
the answer to this problem is? Please respond directly via e-mail and post to
the news group if you can assist.
Thank you,
Jim
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 17 Mar 1998 11:37:06 -0600
From: schwern@starmedia.net
To: guenzel.p1@usa.net
Subject: Re: perl5_00402 needs > 50MB on my Win95 system:-( Any ideas?
Message-Id: <6emc8m$mip$1@nnrp1.dejanews.com>
I don't know about Windows specific issues here, but you could simply lower
the block size on your disk to something like 2K or 4K. This will slow you
down a tad, but save you lots of space.
Or create a seperate, smaller partition for Perl (and other apps with lots of
tiny files) with a small block size. (This is the typical Mac technique.)
PQMagic is useful for stuff like this.
Or you could just come to your senses and run a RealOS. :)
In article <890130207.8786.1.nnrp-03.c1ed20e5@news.demon.co.uk>,
guenzel.p1@usa.net (Bjoern Guenzel) wrote:
>
> Unpacking the perl5_00402-bindist04-bc.zip package (size 5.88MB)
> reduces my available disk space by 50MB when I unpack it, although the
> resulting directory is said to have only the size of 16.x MB :-(
>
> I guess this must be because of the notorious disk-partition problem
> (every file uses at least 16K or something like that, and the perl
> directory contains >2000 files).
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 17 Mar 1998 17:11:51 GMT
From: ruth@utdallas.edu ()
Subject: redirect stderr and stdout to the same file
Message-Id: <6emasn$4h8$1@news.utdallas.edu>
Hi,
I'm using perl on NT and here's my problem:
I have a batch script that runs perl script which calls another perl
script which calls other programs (any executables or batch scripts).
cmd1.cmd --> perl p1.pl --> perl p2.pl --> other exe or bat or whatever.
I want all the stdout and stderr from the second perl and all the
program to appear in one log file as they are printed.
I've tried to close STDERR and STDOUT and open them with redirection to
the log file:
.
.
.
$|=1
close(STDERR);
close(STDOUT);
open (STDOUT,">> $logfile");
open (STDERR,">> $logfile");
the problem that I have is that always the stderr appears before the
stdout, and the output of different programs appear together , and not
in between other messages:
in p2.pl :
.
.
print STDOUT "before program A\n";
system("A.exe");
print STDOUT "after program A\n";
.
.
(in A I have several prints to stdout and stderr)
the messages from A program will appear together , before the two
messages of the perl script.
Any help or suggetsion will be welcome
TIA, Doron (doronve@amdocs.com)
------------------------------
Date: Tue, 17 Mar 1998 16:40:12 GMT
From: prw@vanitydomain.net (Paul Wilson)
Subject: Re: searching a file in Perl
Message-Id: <350ea69a.85411063@news.bestweb.net>
On Tue, 17 Mar 1998 13:29:37 -0800, Gerald <G.W.Lewis@cs.cf.ac.uk>
wrote:
>Im currently working on an online catalogue and i am having trouble
>getting to grips with searching a fle is it possible.
>
>i would be gratefull of some help
Pretty simple to do, although this can be a slow way especially if
you're searching a big file:
$foo = "whatever you're searching for";
open(FILEH,"<filename");
while (<FILEH>) {
if (/$foo/) {
print;
}
}
close(FILEH);
Paul.
------------------------------
Date: 17 Mar 1998 11:07:28 -0600
From: Quentin Fennessy <quentin@jihad.amd.com>
Subject: Re: Sendmail and Mime.
Message-Id: <ximu38xb60f.fsf@jihad.amd.com>
>>>>> "p" == pepe <xixo@jet.com> writes:
There are packages available in CPAN that can help
you generate MIME messages.
Check out:
http://www.perl.com/CPAN
These look like good candidates to check out:
MIME-Lite-1.121.tar.gz
MIME-tools-4.116.tar.gz
MIME-Base64-2.05.tar.gz
--
Quentin Fennessy AMD, Austin Texas
------------------------------
Date: Tue, 17 Mar 1998 15:57:38 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Telnet control codes, stumped!
Message-Id: <slrn6gt792.2lc.jgloudon@manitoba.bbn.com>
In article <6ej97v$8dt$1@aginor.webplanets.com>, Andy Tompkins wrote:
>Ok, in the interest of hiding the text of a password, during entry, over a
>socket connection, i have come to the conclusion that i should be doing
>this through the telnet protocol (thanks Uri!).
>Basically this is what im doing now:
What end of the connection is this ? The telnet daemon (server) or the telnet
client. If you're using the Net::Telnet package there shouldn't be any echoing
taking place.
>is this how YOU would be doing this?
>or am i missing something in my train of thought?
>Also, any idea wy SOME of the socket constants are defined and others not?
>i noticed MSG_OOB is, but MSG_URG (0x800) is not...
URG is OOB.
Jason Gloudon
------------------------------
Date: Tue, 17 Mar 1998 11:31:40 -0600
From: schwern@starmedia.net
To: aet@aryth.webplanets.com
Subject: Re: Telnet control codes, stumped!
Message-Id: <6embu8$m2q$1@nnrp1.dejanews.com>
Net::Telnet
In article <6ej97v$8dt$1@aginor.webplanets.com>,
Andy Tompkins <aet@aryth.webplanets.com> wrote:
>
> Ok, in the interest of hiding the text of a password, during entry, over a
> socket connection, i have come to the conclusion that i should be doing
> this through the telnet protocol (thanks Uri!).
> Basically this is what im doing now:
<snip>
> needless to say, none of it works...
> so, any ideas?
> is this how YOU would be doing this?
<snip>
> Thanks
> --- andy
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 17 Mar 1998 10:55:42 -0600
From: Matt Sisk <mps@shellus.com>
Subject: Re: Using regex to initial cap a name
Message-Id: <350EAB0E.825B9E80@shellus.com>
Paul Neubauer wrote:
> Cabeza de Vaca, Juan
Good one, my friend!
--
Matt Sisk mps@shellus.com
------------------------------
Date: Tue, 17 Mar 1998 18:00:23 GMT
From: Kent Scheidegger <cjlf@netcom.com>
Subject: Webget and Win95
Message-Id: <cjlfEpz60o.K4L@netcom.com>
Here is a question from a complete newbie to perl. I expect I'm missing
something obvious, but can't figure out what it is.
I want to run a very simple perl program to get web pages. I've copied
the webget program from the llama book. It works fine on my Unix shell
account. However, I can't get it to work on Win95. (I'm using the
ActiveState port of perl.)
I connect to my ISP with Win95 Dial-Up Networking. Then I run perl and
the webget script. It says it can't connect to the host. What else does it
need?
Thanks in advance for any info.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2118
**************************************