echoprint-codegen
echoprint-codegen copied to clipboard
Don't spawn a separate thread if there is only one input file
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.
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 bool use_threads = (count > 1);
for thread-supported platforms.
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