If you've got to search the raw file, not really. Every search optimization "thing" builds an index of some sort that is very fast to search, and then matches are related back to the real data so you can pull out the right stuff. Building such an index is expensive, but if you're going do a lot of searching, then it's well worth it.
Assuming you don't want to index the file before searching it, you can probably get a little better speed by increasing the buffer size of your BufferedReader and pull larger blocks of the file into memory for searching. I.e. don't read a line, see if it matches, and then move onto the next, read in a hundred lines, and see if there are any matches. If there aren't, move to the next block, but if there are, then break it down into individual lines and figure out which one actually matches so you can display. As long as you've got a miss-heavy search, that should be faster, because the actual search machinery will have to be started up far fewer times. Threading would also be a way to give the appearance of speed without actually having to run any faster (because you could start showing results as they're found, rather than waiting until the search is complete), but that's a rich topic to get into if you're trying to avoid a crash course in CS. ;) cheers, barneyb On 8/8/05, Ian Skinner <[EMAIL PROTECTED]> wrote: > I'm using a java class (RandomAccessFile) to read through a large text log > file. My applet has a search capability, but it is not very efficient. > > This is my lack of a Computer Science degree shows up. My search is a > vanilla linear text search starting at the beginning and going to the end of > the text file. It takes about 9 seconds to search approximately 1% of the > file. > > I made this work by stopping it at a certain point (100 arbitrary "pages"). > Not too bad. But are they more sophisticated, efficient and/or quicker > methods to search an unordered text file for matching parameter strings? Can > these methods be utilized in a simple ColdFusion and/or Java way without 3 > months of study? > > > > > -------------- > Ian Skinner > Web Programmer > BloodSource > www.BloodSource.org > Sacramento, CA > -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:214054 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

