why the performance is so low when using pointer checker?
There two two compiler parameters:
1. CFLAGS= -O0 -check-pointers:rw
2. CFLAGS= -O0
Questions:
1. why the former is five fast than the second?
2. how does the pointer checker work? Check on every buf or only check on buf[16]
char *buf = malloc(16); for (int i=0; i<=16; i++) { buf = ‘A’ + i; }
3. when I change the "for loop" using SIMD and width of 4, how many times does the point cheker do check?
Hi,
1. Pointer checker adds overhead in terms of the size and execution time of a program. Hence, the performance is low because the execution time is high. Ideally, pointer checker is designed for use only during application testing and debugging and not during deployment.
For questions 2 and 3, we need to check with the Subject Matter Experts(SMEs) and we'll get back to you at the earliest.
--Rahul
To answer your curiosity, place a debugger break point on the line of interest and then at break, open a Dissassembly view.
Or when compiling, choose to output: Assembly with Source Code (/FAs). Do this (to different files) for with and without pointer check.
Then compare both outputs.
The VTune data will also show what and where things are going on (in Dissassembly window).
Jim Dempsey
When memory is allocated for that pointer, its upper and lower bound will be saved in a "bound table". Every time you access it, it will be checked against upper and lower bounds. So, #2 should be buf and #3 should be 4 times fewer.
For more complete information about compiler optimizations, see our Optimization Notice.