-
Notifications
You must be signed in to change notification settings - Fork 291
Don't spawn a separate thread if there is only one input file #34
base: master
Are you sure you want to change the base?
Conversation
src/main.cxx
Outdated
| while(done<count) { | ||
| // Check which threads are done | ||
| if (!use_threads) { | ||
| // Threading doesn't work in windows yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better location for this comment might be up by the #ifdef _WIN32 directive. It could also be that use_threads is false because the user is processing one file on a system which does, in fact, support threads.
|
The current patch properly handles the case where the system supports threads but only one file is being processed (tested on OSX Lion with a single input file), but that's a good point about combining the #ifdef _WIN32 statements together. I'll submit a new pull request when I get a moment. |
|
I took another look at this patch and I didn't see another more obvious place for the use_threads variable. Putting it any earlier in the file means the count variable won't be initialized, breaking |
|
Oh, I meant just for the comment, not the variable itself. (So it should be a trivial modification..?) |
|
Bumping this patch for consideration. |
|
Thanks, @jhurliman! We're accepting this patch and it will be merged in. |
|
Just checking on the status of this |
This patch changes the logic in main.cxx (for platforms where echoprint-codegen can spawn multiple threads) to only spawn threads when more than one file is being fingerprinted. This results in a significant speedup for a common use case where echoprint-codegen is ran once per input file.