c - Why is floor() so slow? -
I recently wrote some code (ISO / ANSI C), and it was astonished on poor performance. Short story short, it came to know that the culprit was the floor () function. Not only was this slow, but it was not vectored with Intel compiler, aka ICL.
There are some benchmarks for making floor for all cells in 2D matrix:
VC: 0.10 ICL: 0.20 Compare to a simple artist:
VC: 0.04 ICL: 0.04 how floor () compare to a simple artist Can be very slow in?! It essentially does the same thing (for negative numbers). Second Question: Does anyone know about superfast floor () implementation?
PS: This is the loop that I was benchmarking:
Zero level (float * matte, int * intra, constant int height, constant int width, con width width) { Float * Row A = Faucet; Int * intRowA = NULL; Int row, col; (Row = 0; line and height; ++ row) for {rowA = matA + line * width_conversion; IntRowA = intA + line * width_aligned; #pragma ivdep (col = 0; col; lt; width; ++ col) {/ * intRowA [col] = floor (rowA [col]); * / IntRowA [col] = (int) (rowA [col]); Some things slow down the floor of an artist and prevent vectoring. I
Comments
Post a Comment