1. searching...
- Posted by The Reaper <reaper at LOKI.ATCON.COM> May 09, 1997
- 970 views
O.K., I am in the process of making an update to my ZipMaster program. The thing that bugs me most about it is that it is so darn slow! I search the file string by string comparing every word to each other. Does anyone else know a faster way to look for certain words withen text files? Oh yeah, and I added support fo finding files loaded by Babor's font.e and by Micheal Bolin's awesome pic_load.e, but does anyone know any other file-loading functions that should be added? =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The Reaper (J. Lays) http://www.geocities.com/TimesSquare/Alley/4444/ reaper at auracom.com Check out my Euphoria Games page at: -= http://www.geocities.com/TimesSquare/Alley/4444/eugames.html ........................ . .. -||..........__...... "There are those who spend their life . / ||......../-- \\.:::: Dreaming of their desire; . ..| ||...... / | |.::: You can either live to make it happen, .| _-||.......|| / /.:::: Or burn in misery's fire." ..| |..||...... -\_- \ |\-.::: .| |.[< \ .../ \.:: .||.|||\|\ | - - . \.:::: ...|.\|| | \ | | |.:::. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
2. Re: searching...
- Posted by Marcel Kollenaar <M.Kollenaar at SLO.NL> May 11, 1997
- 975 views
reaper at LOKI.ATCON.COM wrote: > > O.K., I am in the process of making an update to my ZipMaster program. > > The thing that bugs me most about it is that it is so darn slow! I search > the file string by string comparing every word to each other. Does anyone > else know a faster way to look for certain words withen text files? > Yes, there are several way's. 1. searching by the Knuth-Morris-Pratt method. 2. searching by the Boyer-Moore method, BM-search. Use 2. BM-search uses the method to start the comparing of the string at the end and not from the begin of the string. You can find these methods and modula-2 code in the book: Algorithms and data structures, from Niklaus Wirth. And there are several homepages from univerities that show these information. R.S. Boyer en J.S.Moore. A fast string searching algorithm. Comm. ACM, 20, 10 (okt 1977), pag 762-772. Good luck, Marcel Kollenaar
3. Re: searching...
- Posted by Jacques Deschenes <desja at QUEBECTEL.COM> May 11, 1997
- 965 views
At 08:17 97-05-09 -0400, you wrote: >O.K., I am in the process of making an update to my ZipMaster program. > >The thing that bugs me most about it is that it is so darn slow! I search >the file string by string comparing every word to each other. Does anyone >else know a faster way to look for certain words withen text files? Instead of checking each line character by character your program could eliminate most of them with a simple test like: sequence line -- contain line read from file if not match("include",line) and not find('"',line) then return -- skip this line end if Your zip master is only concern by lines that begin with the word "include" and others that have double quotes. Resources files names have to be between double quotes. And zip master doesn't need to know wich procedure or function load the requested resource. Zip master only have to check if the double quotes enclose a valid file name. Your program could have a function that check the contain of any double quotes found in the file to see if it is a file name, a directory name or else. Directories names are added to a sequence containing path_list for future search of files. File names are searched on hard disk in any directory member of path_list and current directory. the preceding method is based on the following assumptions: 1) any line beginning with the word "include" is followed by file name and nothing else. 2) Any double quote containing a path name is certainly assigned to a constant or variable that point to directory where the program search files. 3) Any double quote containing a string that is a valid dos file name is possibly a resource name. It can be confirmed by searching on disk for such a file. I have tested this method with success. Jacques Deschenes Baie-Comeau, Quebec Canada desja at quebectel.com
4. Re: searching...
- Posted by The Reaper <reaper at LOKI.ATCON.COM> May 12, 1997
- 954 views
At 10:21 AM 5/11/97 -0400, you wrote: > Instead of checking each line character by character your program could >eliminate most of them with a simple test like: > > sequence line -- contain line read from file > > if not match("include",line) and not find('"',line) then > return -- skip this line > end if This is good stuff, do that's no surprise considering it's coming from you. By the way, your SFX2.E is absolutly fantastic!!! Anyways, the only problem here is that it will also check comments. Some people put comments after their "include whatever.e" (like me) and also put filenames that they are not using yet behind comments, though the file is still there. I solved most of ZipMaster's problems by getting rid of the code that writes the line number to the screen. I put that there because the program was so slow, but it turns out that was what was slowing the program down in the first place. Ugh! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The Reaper (J. Lays) http://www.geocities.com/TimesSquare/Alley/4444/ reaper at auracom.com Check out my Euphoria Games page at: -= http://www.geocities.com/TimesSquare/Alley/4444/eugames.html ........................ . .. -||..........__...... "There is a shadow that looms over life, . / ||......../-- \\.:::: Of knowledge that will never be found; . ..| ||...... / | |.::: You can guess or waste your life on it, .| _-||.......|| / /.:::: Or look beyond into what's next." ..| |..||...... -\_- \ |\-.::: .| |.[< \ .../ \.:: .||.|||\|\ | - - . \.:::: ...|.\|| | \ | | |.:::. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-