Re: Speed question

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

Yeah, spend your 15 minutes reading the array.
after that.. right it out in a better format and always read it using
the better format.
you could use EDB.  seems overkill for what you state.
but maybe you should look at it.
You state that every word is exactly 8 characters in length.
This tells me to use a fixed width database.

All of the code below assumes that every word in the
array is exactly 8 characters long.

integer out
out = open("new.txt", "wb") -- for saving in a simple format
for A = 1 to length(word_array) do
  puts(out, word_array[A])
end for
close(out)


include get.e

integer in
sequence s
in = open("new.txt", "rb") -- for reading the new format
s = get_bytes(in, 8)
while length(s) do
  word_array &= {s}
  s = get_bytes(in, 8)
end while

        Lucius L. Hilley III - Unkmar

PS: Cheers, and I hope this helps.
    I whipped this up in a hurry before going to bed.

----- Original Message ----- 
From: "Allen Robnett" <alrobnett at alumni.princeton.edu>
To: <EUforum at topica.com>
Sent: Monday, January 19, 2004 09:08 PM
Subject: Speed question


> 
> 
> After opening a Euphoria text file "r", I am reading in one million 
> 8-character words, (the entire file).
> 
> clear_screen()
> fp=seek(fn,0)
> s = get(fn)
> close(fn)
> word_array = s[2]
> 
> word_array[4][6] is then the 6th letter of the 4th word in the array.
> 
> It works fine, but it takes fifteen minutes to read in the array. Is 
> there a better way?
> 
> Allen
> 
> 
> 
> TOPICA - Start your own email discussion group. FREE!
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu