Click here to Skip to main content
15,886,821 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
Hello, experts.

I've just make search program which search mentioned string from files like "Find in files on Microsoft Visual Studio" with C++ language. But my program is too slow.

I've implemented search algorithm like this.

First. Find files matched search filters.
Second. Read matched files one by one and search string which is inputted from read file.

Well, it works well but it took a lot of time to finish search.

Does anybody know how can I speed up this?

Thank you.
Posted
Updated 24-Nov-13 14:46pm
v4
Comments
Sergey Alexandrovich Kryukov 22-Nov-13 21:20pm    
All correct, so far. But the performance depends on how you implemented it...
—SA
WuRunZhe 22-Nov-13 21:36pm    
Yes, you are right.

I've mentioned on my question, I started find matching files first and read every matched files one by one and search wanted string from contents of opened file.

It probably takes very long time. I know.

So I want to change my algorithm, but I don't know how can I change my algorithm to speed up.
Sergey Alexandrovich Kryukov 22-Nov-13 21:44pm    
We cannot help you if we don't know what it that, isn't that logical?
—SA
WuRunZhe 22-Nov-13 21:48pm    
Well, I'm not good at english so I could explain what I want in long sentences.
But important is that I want to know the very fast search algorithm like Microsoft Visual Studio uses.
Sergey Alexandrovich Kryukov 22-Nov-13 21:58pm    
Good bye.
—SA

1 solution

 
Share this answer
 
Comments
WuRunZhe 23-Nov-13 21:37pm    
Hello, Mehdi Gholam

I've seen "hOOt - full text search engine[^]" and download source and invoke it. But, it is not neccessary for me, I think.

First, this is made by C# and I didn't know C#. So I need C++.
Second, from this article, it said, searching 4490 files need 22minutes. It's too long. I think. Thank you.
Mehdi Gholam 24-Nov-13 5:01am    
You did no mention the language so .net was assumed, but you can use the algorithm in hOOt.
WuRunZhe 24-Nov-13 20:47pm    
Very sorry.
I've just modify my question under your comment. Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900