I worked on a portable C library that processes images.
I spent quite a bit of time on a couple of low-level functions to take advantage of GCC automatic vectorization (SSE and / or AVX depending on the target processor), while preserving somewhat portable C code (extensions used: restrict and __builtin_assume_aligned ).
Now it's time to test the code on Windows (MSVC compiler). But before that, I would like to set up some kind of unit testing so as not to shoot in the leg and not lose all my carefully selected instructions in order to keep the GCC auto-injection code as it is.
I could just #ifdef/#endif whole body function, but I am thinking of a longer-term solution that would be found when updating the compilation (s) of any regression.
I am pretty confident in unit testing (there are a lot of good circuits out there), but I'm much less confident in unit testing such low-level functions. How to integrate performance testing in a CI service like jenkins for example?
PS: I would like to avoid storing hard-coded synchronization results based on a specific processor, for example:
// start timer: gettimeofday(&t1, NULL); // call optimized function: ... // stop timer: gettimeofday(&t2, NULL); // hard code some magic number: if( t2.tv_sec - t1.tv_sec > 42 ) return EXIT_FAILURE;
malat source share