Re: $100 Contest Question

new topic     » goto parent     » topic index » view thread      » older message » newer message

On 3 Mar 2002, at 14:37, Derek Parnell wrote:

> 
> ----- Original Message -----
> From: "Kat" <gertie at PELL.NET>
> To: "EUforum" <EUforum at topica.com>
> Sent: Sunday, March 03, 2002 1:15 PM
> Subject: Re: $100 Contest Question
> 
> 
> > On 3 Mar 2002, at 0:22, C. K. Lester wrote:
> >
> > >
> > > For the contests, what is "standard input?"
> > >
> > > When it says, " Write a program in Euphoria that reads from standard
> > > input a "cipher" line containing the 26 letters of the alphabet,
> > > rearranged somehow, e.g.
> > > PQRSTUVZABCDEFGHWXYIJKLMNO"
> > >
> > > does the "standard input" indicate a file?
> > >
> > > Or is standard input the keyboard?
> > >
> > > I know I could probably find this in the docs, but this is much more
> > > reliable. :)
> >
> > I was wondering this too. File input, dox box, windoze gui, or wxwindows,
> or
> > what?
> >
> > > Also, will the cipher line necessarily be sequential? For instance,
> > > might we encounter:
> > >
> > > ABCDEFGHIJKLMNOPQRSTUVWXYZ
> > > PRSTWUVZQMABCDEFGHXYIJKLNO <-- cipher line
> > >
> > > This is a simple one-to-one replacement, but the cipher line, you'll
> > > note, is not sequential.
> >
> > It *is* sequential, but it's not alphabetical.
> >
> > My new question: It's taking me 143 seconds to load a dictionary with the
> > following code:
> >
> > dfilename = "D:\\Gertie\\decypher\\dfile.txt"
> > readfile = open(dfilename,"r")
> > readline = get(readfile)
> > readline = readline[2]
> > close(readfile)
> >
> > And since i don't see how i can make that any faster, can we *not* count
> > load times for this contest? My puter is a K6-2-233 running win95, so it's
> > prolly the slowest one here (not counting Igor's 386's), but still, i
> don't see
> > the load times improving off the hd with faster cpus..
> >
> Hi Kat,
> I would advise people not to use get() unless there was a really good reason
> to
> do so. It is a very slow way of reading in text. Even so, 143 seconds is
> amazingly slow.

But it reads the whole file at one time,, no optimisation behind the scenes?

 What about saving the file? Looks to me like saving it with the 
prints(file,HeavilyNestedSequence) by using 5x as much space as the 
original is overkill.
 
> Here is a test I whipped up and in takes 0.07 seconds to run on my machine
> (Pentium III,550MHz, 256Meg, Windows Me).

I ran it, my best run was .67sec,, they generally ran 1.4sec. So i need to 
figure my runs of 50minutes will meet the 5minute runtime limits of the 
contest? <blink><blink>

>  -------------
>  include get.e
>  include file.e
>  atom flen
>  atom s
>  sequence dfilename, readline
>  integer readfile
>  s = time()
>  dfilename = "f:\\euphoria\\words.txt"
>  readfile = open(dfilename,"rb") -- NB, binary for speed
>  flen = seek(readfile, -1)
>  flen = where(readfile)
>  if seek(readfile,0) then end if
>  readline = repeat(0,flen)
>  for i = 1 to flen do
>     readline[i] = getc(readfile)

This doesn't allow for any premunging of the dictionary, or entry of it into 
nested sequences. Does it?

>  end for
>  close(readfile)
>  printf(1, "%f\n", time()-s)

As Euman pointed out, i haveto squeeze as much out of the 5 minute 
contest timeframe as i can, so i premunged the dictionary. I have no 
concrete factor to figure the difference in exec times, but loading the 
premunged, nested seq dictionary is way faster than munging it, loading 2 
dictionaries and munging, then writing out, took 19 minutes.

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu