Changing data types, Continued
- Posted by Allen V Robnett <alrobnett at alumni.princeton.edu> Mar 22, 2004
- 404 views
Brian Broker <bkb at cnw.com> wrote: >Allen V Robnett wrote: > ><snipped response> > > >>Thanks for the response. I believe match() is restricted to sequences. >>Given the 200MB size of my data file, even without Euphoria's sequence >>delimiters, and given the relative speed of reading the undelimited file >>into RAM at the beginning of a session, and then back out at the >>conclusion, it seemed preferable to me to use peek and poke on an >>undelimited, allocated file buffer. The editor program will search the >>entire file in 7 seconds. >> >> >After reading this, I'm not sure if you still have a question. It might >help to know at least what platform (DOS, *nix, Win) you are working >with to determine the best (or fastest?) solution. > >-- Brian > > Originally I had a problem. Having figured out AN answer before getting any response, but it may not be THE answer. I now have several questions rather than a problem. I am using Windows XP HE on a Dell Pentium 4, 2.53 GHz; 533 MHz FSB with 80 GB HD. The windows capabilities of my OS makes it possible for me to use the EU program in a window-like way, even though is is written in vanilla DOS mode. As a first crack, I was looking for simplicity and speed, and know little about programming and nothing about programming for Windows. The data file that I am building is a binary tree with fixed length nodes. Each node (at location n) has 2 children nodes (at locations 2n and 2n+1). Reading through and displaying all of the parent nodes in the branch for any given node is not difficult. There is no need for any system of record keys. When I tried to implement the system using EU's sequences, the size of the data file more than doubled, and the time taken to read the file into memory was on the order of ten minutes. When I stripped out the sequence delimiters and treated the whole file as one big number, I was able to allocated a buffer and read the file into it in 6 seconds. Rob Craig says all EU objects are either atoms or sequences. Of course this file is not an EU object, but that was the point of my question. I have discovered that there is no problem in pointing to a 4-letter part of a word and telling EU to treat it as an integer. It is then compared with a similarly constructed search integer. The method can search the entire file in 7 seconds. I know that there are many participants in this forum whose forte is speed in searches. My current question is, is there a better way to accomplish my goal within EU, either speedwise or stylewise? I am actually content with the 7 seven second result, if it cannot be improved. Thanks to the many who have taken time to be of help. Allen