Re: $100 Contest Question

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

----- Original Message -----
From: "Kat" <gertie at PELL.NET>
To: "EUforum" <EUforum at topica.com>
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.

Here is a test I whipped up and in takes 0.07 seconds to run on my machine
(Pentium III,550MHz, 256Meg, Windows Me).

 -------------
 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)
 end for
 close(readfile)
 printf(1, "%f\n", time()-s)
 --------------
Derek

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

Search



Quick Links

User menu

Not signed in.

Misc Menu