[26630] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8739 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 6 21:05:22 2005

Date: Tue, 6 Dec 2005 18:05:06 -0800 (PST)
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, 6 Dec 2005     Volume: 10 Number: 8739

Today's topics:
    Re: A simple inheritance question. <invalid@nowhere.com>
    Re: A simple inheritance question. <sbryce@scottbryce.com>
        Perl Blather Generator vjp2.at@at.BioStrategist.dot.dot.com
    Re: Perl Blather Generator (Bengt Richter)
    Re: Slow insertion to hashes? xhoster@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 06 Dec 2005 17:35:59 -0600
From: Don Gatlin <invalid@nowhere.com>
Subject: Re: A simple inheritance question.
Message-Id: <pan.2005.12.06.23.35.48.760056@nowhere.com>


> Of course not:
> 
> $object2->addakey();
> 
> and now it does.
> 
> Also: read about SUPER, don't do this:
> 
> 
Thanks for the reply.  I don't understand it yet but I will get there.
Eventually.

Interesting about SUPER.  Two of my books (they must be good, because they
are super thick) don't even have the keyword in the index.  The O'Reilly
one does, but only references one sentence. I admit that all three are
just general Perl books and don't pretend to teach OOP.  Got to get a book
on actual POOP if one exists.

DG


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

Date: Tue, 06 Dec 2005 17:10:48 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: A simple inheritance question.
Message-Id: <pOidncmHXpzntQvenZ2dnUVZ_t6dnZ2d@comcast.com>

Don Gatlin wrote:
> Got to get a book on actual POOP if one exists.

Object Oriented Perl by Damian Conway


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

Date: Tue, 6 Dec 2005 23:11:54 +0000 (UTC)
From: vjp2.at@at.BioStrategist.dot.dot.com
Subject: Perl Blather Generator
Message-Id: <dn55rq$mov$1@reader2.panix.com>


   I'm sure I've seen programs that generate blather but now I
can't find one.  I'm stuck in a wierd situation that comes up often
enoguh:  Some third-worlders insist you write pretentious casuistry
when a few simple words are enough. It is sad in these day of "Fog
Index" that we have people who are commitedly ideological and even
theologically dogmatic about making prose incomprehensibly obfuscated
and complicated. I want it in perl so it can be extremely portable.

   However, I want something I can control. For example, when it sees
the word "customer" or "strategy" it should randomly chose one of
three flowing phrases.  I can write a simple one-to-one in sed, but I
really hope some ingenious soul has already compiled a blatherisation
table that I only need to tweak.  The issue is the text should require
no more than, say, ten percent editing to make it seem like it came
from a genuinely glib casuistrous bullshit artist.

   I wouldn't mind if the program is ingenious enough to go both ways,
or even to be adjustable (ie, "please set the fog index").  I am
confronted with enough blathermaniacs and antiblathermaniacs to make
my life way too complicated. By the time I get used to one lunatic, I
have to instead conform to the other.  In fact, I dug up an
unblatherising sed script:

s#anybody#they#g
s#anyone#they#g
s#as to whether#whether#g
s#as you# #g
s#body of#set#g
s#prone#face down#g
s#case#that#g
s#feel#believe#g
#  s#whose#who(his?)se#g
#  s#whom#who(him?)m#g
s#iness#y#g
s#via#by way of#g
s#due to#caused by#g
s#kudos#prize#g
s#certainly#yes#g
s#character#he#g
s#compare#like#g 
s#consider#think#g
s#convenience#soon#g
s#dependable#reliable#g
s#deviat#off#g
s#discrep#off#g
s#due to#because#g
s#effect#do#g
s#extent#way#g
s#factor#cause#g
s#feature#part#g
s#fictitious#false#g
s#fix#mend#g
s#flow of# #g
s#fluke#accident#g
s#friend#someone#g
s#herewith# #g
s#honest#true#g
s#however#but#g
s#kind of#like#g
s#kudos#praise#g
s#less#fewer#g
s#line#way#g
s#literal#actual#g
s#lose out#fail#g    
s#modern#new#g 
s#more better#better#g
s#nature#way#g  
s#near by#close#g
s#nearby#close#g       
s#needless# #g
s#one of the most#one#g
s#people#they#g
s#per#for#g
s#perusal#eyes#g
s#phase#step#g
s#possess#own#g
s#prone#likely#g
s#quantum#big#g
s#relativ#compar#g
s#respective# #g
s#rest assured# #g 
s#so # #g
s#sort of#like#g
s#state#say#g
s#system#way#g     
s#theor#idea#g
s#uncert#maybe#g
s#velocity moves#it moves#g
s#via#by#g
s#virtual#real#g
s#while#;#g
s#whom#that#g
s#worthwhile# #g
s#would#should#g   
s#ated#ed#g
s#ize#e#g
s#ise#e#g
s#which#???#g





				- = -
    Vasos-Peter John Panagiotopoulos II, Columbia'81+, Bio$trategist
	      BachMozart ReaganQuayle EvrytanoKastorian
  ---{Nothing herein constitutes advice.  Everything fully disclaimed.}---



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

Date: Wed, 07 Dec 2005 00:48:39 GMT
From: bokr@oz.net (Bengt Richter)
Subject: Re: Perl Blather Generator
Message-Id: <4396313a.348036169@news.oz.net>

On Tue, 6 Dec 2005 23:11:54 +0000 (UTC), vjp2.at@at.BioStrategist.dot.dot.com wrote:

>
>   I'm sure I've seen programs that generate blather but now I
>can't find one.  I'm stuck in a wierd situation that comes up often

    http://www-personal.umich.edu/~jlawler/foggy.faq.html

Regards,
Bengt Richter


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

Date: 06 Dec 2005 23:27:10 GMT
From: xhoster@gmail.com
Subject: Re: Slow insertion to hashes?
Message-Id: <20051206182710.481$Mb@newsreader.com>

Jindroush <jindroush.nospam@seznam.cz> wrote:
> Jindroush wrote:
> > Hi,
> >
> > I have to load a file. I 'index' the records in two hashes. At the
> > beginning I do:
>
> > This works good up to cca 70000 records (file1
> > has about 91000 records, each record is about 85 chars, split in 6
> > strings). Then it is _DEAD SLOW_. I load three such files in 3 (6)
> > different hashes. The two other files are also _DEAD SLOW_. I have
> > quite fast computer and s**tloads of free ram. Running: v5.6.1 built
> > for MSWin32-x86-multi-thread (activestate) on WXP (no way to change the
> > perl version/os).
> >
> > Why is it so slow? How can I make it faster?
>
> According to the messages, I'm posting more 'proper' problem report.
>
> The code is below. Input file is about 91k records, 8.8MBs. I have 1GB
> of ram, the script takes under 50megs while running. So no swapping
> (100%). I tried to comment various parts of the script and it seems that
> the whole problem is the size of each %H. The shorter it is, the faster
> the script works. How to solve that (easily?).
>
> use strict;
>
> my %DB;
>
> my $in = "file1";

##Because I couldn't run your program without file1, I added this
##code.  I used 1_000_000 because hey, let's push the limits.
{
  open my $fh, ">$in" or die $!;
  foreach (1..1_000_000) {
    print $fh join (" ", map substr(rand(),0,15), 1..6), "\n";
  };
  close $fh or die $!;
};

>
> my $fl = -s $in;
> my $recs = int( $fl / 85 );
> keys( %DB ) = $recs;
>
> open IN, $in or die;
>
> print "Loading '$in'...\n";
> print( "preallocated $recs records...\n" );
> my $cnt = 0;
> my $st = time;
> while( my $line = <IN> )
> {
>         chomp $line;
>
>         my( $v1, $v2, $v3, $v4, $v5, $fname )= split( / /, $line);
>
>         my %H;
>         $H{ v1 } = $v1;
>         $H{ v2 } = $v2;
>         $H{ v3 } = $v3;
>         $H{ v4 } = $v4;
>         $H{ v5 } = $v5;
>         $H{ fname } = $fname;   #must be here

you could replace this with:

          my %H;
          @H{qw(v1 v2 v3 v4 v5 fname)} = split (/ /, $line);

I think it looks better, but I doubt it will make things faster.

>
>         $DB{ lc $fname } = \%H;
>
>         printf( "%4d $cnt\n", time - $st ) unless ( $cnt % 1000 );
>         $cnt++;
> }
> close IN;
> print "\n";

I don't see anything obviously wrong with your code.  The problem is
probably with your data (hash key collisions) or with your system (reading
the file iteself is very slow, once you get beyong the part that is cached
from before. Or some kind of VM problem.  Or something else)

Generating the file the way I did above, I saw absolutely no slowing at all
all the way up to a size of 1_000_000.  What do you see if you use my
random data rather than your actual data?

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 8739
***************************************


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