CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 1999
    Location
    CA
    Posts
    91

    I need more speed Baby!

    What is faster?:
    Searching for a word through multiple text files (Additionally which is faster: all the files in their own directories, or all in the same directory?)

    or

    Searching for a word through one file that is the sum of all the other files by stepping through it one "group" at a time?

    Brewguru99

  2. #2
    Join Date
    Oct 1999
    Location
    CA
    Posts
    91

    Re: I need more speed Baby!

    Hey? What? No takers?

    Brewguru99

  3. #3
    Join Date
    Sep 1999
    Posts
    202

    Re: I need more speed Baby!

    The answer is - it depends. Single InStr can be a bit faster, but reading big file in memory can cause swapping, so it can be slower.

    I think grouping files is not good idea.


  4. #4
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: I need more speed Baby!

    In addition to Bruno's post - you'll also find that using the VB 'Like' command is a lot quicker to see if a text string contains the text you're looking for than using InStr (although it only tells you if it's there, it won't give you a position in the text so you'll still need InStr).


    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

  5. #5
    Join Date
    Sep 1999
    Posts
    202

    Re: I need more speed Baby!

    Hey, excellent Tip. We VBers need more speed with strings and every Tip is welcome.

    "Like" works great with case-insensitive searches - Instr is slow when vbTextCompare option is used.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured