Author Topic: Which Search is Faster?  (Read 2641 times)

dfechser

  • Senior Community Member
  • Posts: 123
  • Hero Points: 0
Which Search is Faster?
« on: December 04, 2014, 07:05:46 PM »
I periodically run some really big searches inside comments within 10,000+ files.
I can limit the search by setting the color to comments-only but I'm curious to know:
  • Does the selection of comments-only result in a faster search?
  • Is it faster to run a simple search with no color limitations?

The search strings occur only in comments so I don't run a risk of getting invalid (non-comment or non-string) results if I leave off the color limitation. I'm just wondering if, assuming half of each file contents are comments, the simple search would be faster.

Please don't spend a lot of time on this; I'm simply curious and might save some time if I knew this answer.

Thank you,

Dave F.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Which Search is Faster?
« Reply #1 on: December 05, 2014, 09:01:18 AM »
Probably doesn't effect performance much.

If you want screaming speed, try using the "sgrep" utility in the Build window. It only support active code page stuff (no unicode) but for many of us, that's all we need.

     sgrep main -t "*.cpp" "*.h"      -- recursive
     sgrep main -i -t "*.cpp" "*.h"      -- ignore case, recursive
     sgrep main -w -t "*.cpp" "*.h"     -- match whole word, recursive
     sgrep main -r -t "*.cpp" "*.h"      -- SlickEdit regex, recursive
    ...

I use this for many of my simple multi-file searches. When I need color coding (which I sometimes do) or my search is more complex, then I use the GUI.

In the future, we will be making the GUI multi-file searching faster. It will never be as fast as sgrep though.


dfechser

  • Senior Community Member
  • Posts: 123
  • Hero Points: 0
Re: Which Search is Faster?
« Reply #2 on: December 05, 2014, 03:02:13 PM »
I'll have to try that sometime. I don't use the build window so I wasn't aware of the sgrep command.

Dave F.

rgloden

  • Senior Community Member
  • Posts: 169
  • Hero Points: 5
Re: Which Search is Faster?
« Reply #3 on: December 07, 2014, 11:13:33 PM »
Wow sgrep is incredible?

Why isn't this better highlighted in the Documentation?  (Barely found it mentioned in the 2013 documentation.)

Would really love to have this speed from the gui ...

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Which Search is Faster?
« Reply #4 on: December 07, 2014, 11:39:57 PM »
This is on our todo list. There's some infrastructure changes we need in order to speed up the GUI multi-file find (on our list of course).

Another possibility (which we might have to do in addition) is to hook sgrep into the multi-file find. It's more difficult than it sounds. There are a lot of detail issues. There are some interfaces that must be implemented in sgrep ( a lot of work). sgrep only supports active code page which makes it pretty limiting (we could enhance this). sgrep doesn't interpret line breaks exactly the same as the editor but it's probably good enough. sgrep doesn't support color coding searches. A "Use sgrep for Speed" check box would have to be option and off by default.