SUNW0gccfss - questionable performance gains
I have HTTP parser written in C, which is a single file, about 15000 lines of C code. I also have a test program that calls HTTP parsing function in a loop for a range of HTTP headers
Compile executable with SunPro compiler:
# /opt/SUNWspro/bin/cc -o proftest.sunpro -xO3 -xtarget=native proftest.c ../htparser.c
Compile executable with GCC for Sparc Systems compiler:
# /opt/gcc/bin/gcc -o proftest.gccfss -O3 -xtarget=native proftest.c ../htparser.c
Compile executable with regular GCC:
# /opt/pkg/gcc34/bin/gcc -o proftest.gcc -O3 -mcpu=ultrasparc proftest.c ../htparser.c
Time SunPro executable 3 times:
# time ./proftest.sunpro
real0m2.222s
user0m2.096s
sys0m0.018s
# time ./proftest.sunpro
real0m2.148s
user0m2.039s
sys0m0.016s
# time ./proftest.sunpro
real0m2.151s
user0m2.043s
sys0m0.016s
Time GCC for Sparc Systems executable 3 times:
# time ./proftest.gccfss
real0m2.459s
user0m2.299s
sys0m0.018s
# time ./proftest.gccfss
real0m2.415s
user0m2.299s
sys0m0.016s
# time ./proftest.gccfss
real0m2.438s
user0m2.302s
sys0m0.016s
bash-3.00#
Time GCC executable 3 times:
# time ./proftest.gcc
real0m2.434s
user0m2.315s
sys0m0.016s
# time ./proftest.gcc
real0m2.443s
user0m2.313s
sys0m0.016s
# time ./proftest.gcc
real0m2.481s
user0m2.342s
sys0m0.017s
As you can see above, executable generated with SunPro compiler, results in the fastest time. GCC for Sparc Systems and plain GCC produce more or less the same results. I don't really see any performance gains with GCC for Sparc Systems. So my question is, what's the point?
[1819 byte] By [
segv] at [2007-11-26 9:07:58]

# 1
> I have HTTP parser written in C, which is a single
> file, about 15000 lines of C code. I also have a test
> program that calls HTTP parsing function in a loop
> for a range of HTTP headers
Could you be so kind to send us a pointer to this parser (if it's under some free license) so we can take a look on what's going on ?
It seems you assume that faster exec times are better.
What SunPro version are you using ?
The version of plain gcc seems to be 3.4.x ?
Not trying to blame your test, but some benchmarks we've seen reported N times slowdown with GCCfss vs gcc4 whereas the truth was that the hot loop was optimized to a single instruction and algorithm used to calculate performance was bailing out due to overflow in counters.
# 2
Hi, I wrote the parser myself, so it's not available anywhere. I do assume that faster exec times are better, isn't this what the compilers strive to do, i.e. to generate executables that execute faster.
Anyway
# /opt/SUNWspro/bin/cc -V
cc: Sun C 5.8 2005/10/13
usage: cc [ options] files. Use 'cc -flags' for details
# /opt/gcc/bin/gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.10
Configured with: /export/home/bldmstr/nightly/20060207_gcc2ir.s10.opt.tarbuild/src/configure --prefix=/opt/gcc --enable-languages=c,c++
Thread model: posix
gcc version 4.0.2 (gccfss)
# /opt/pkg/gcc34/bin/gcc -v
Reading specs from /opt/pkg/gcc34/lib/gcc/sparc-sun-solaris2.10/3.4.6/specs
Configured with: /opt/pkg.obj/lang/gcc34/work.ultra10-lan/gcc-3.4.6/configure --enable-languages='c' 'c++' 'f77' --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-long-long --with-local-prefix=/opt/pkg/gcc34 --with-libiconv-prefix=/opt/pkg --with-gmp=/opt/pkg --prefix=/opt/pkg/gcc34
Thread model: posix
gcc version 3.4.6
I think using GCC with Sun code generator does not give quite the same results as using Sun compilers. Maybe Sun compilers perform a lot of optimisations which are not available in GCC, hence there is no significant improvement with GCCfss
segv at 2007-7-6 23:23:31 >

# 4
> I think using GCC with Sun code generator does not
> give quite the same results as using Sun compilers.
> Maybe Sun compilers perform a lot of optimisations
> which are not available in GCC, hence there is no
> significant improvement with GCCfss
GCCfss is using the same code generator _and optimizer_ as Sun Studio compiler.
The subtle differences in IR patterns lead to different assembler code that may perform differently depending on appication oddities.
The best way to analyze such things is to run Sun Studio Analyzer.
If you can provide us a small example that shows performance impact we can take look why it's performing this way.