echoprint-codegen icon indicating copy to clipboard operation
echoprint-codegen copied to clipboard

Don't spawn a separate thread if there is only one input file

Open jhurliman opened this issue 13 years ago • 6 comments

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.

jhurliman avatar Feb 21 '12 22:02 jhurliman

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.

jhurliman avatar Feb 23 '12 04:02 jhurliman

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.

jhurliman avatar Feb 28 '12 18:02 jhurliman

Oh, I meant just for the comment, not the variable itself. (So it should be a trivial modification..?)

alnesbit avatar Feb 28 '12 18:02 alnesbit

Bumping this patch for consideration.

jhurliman avatar Aug 01 '12 00:08 jhurliman

Thanks, @jhurliman! We're accepting this patch and it will be merged in.

alnesbit avatar Aug 03 '12 08:08 alnesbit

Just checking on the status of this

jhurliman avatar Apr 08 '13 22:04 jhurliman