Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!umd5!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!uiucdcs!uiucdcsm!grunwald From: grunwald@uiucdcsm.cs.uiuc.edu Newsgroups: comp.lang.c++ Subject: Another Performance Comparison Message-ID: <4800022@uiucdcsm> Date: 14 May 88 15:37:00 GMT Lines: 47 Nf-ID: #N:uiucdcsm:4800022:000:2130 Nf-From: uiucdcsm.cs.uiuc.edu!grunwald May 14 10:37:00 1988 I've (finally) gotten my simulation environment to run under both C++ and G++ and measure the performance of those systems. I think that this is a more ``realistic'' measure of compiler performance than using dhrystones. The program simulates a certain form of circuit switching hardware for a hypercube computer. There are 32 nodes in the simulated system. Each node has 1 CPU, 1 IOP, 5 RECV and 5 XMIT processes, meaning a total of 384 simulated processes. The simulation library (not the application), tries to make heavy use of ``inline'' facility for key data types, in particular the Heap & Fifo data types. When I switched from using the OOPS 'fifo' to less general FIFO, I got a 20% speed up. When I switched from the OOPS 'heap', I got a 30% speed up (over the 20% already gained). This isn't to impress you, it's only to show that some care was taken to use C++ features to speed up the total simulation time. There are 4100 lines of code in the simulation library and about 5300 in the particuar application. The application makes extensive (although not excessive) use of virtual functions. It's uses a fair amount of floating point because time is being measured in fractions of microseconds, and the Pairing Heap used in the event list does floating point comparisons. The time to run the simulation on a Sun 3/260 was: Compiler Time (CPU seconds) ---------------------------------- CC w/gcc 549 G++ 579 CC w/cc -F68881 629 CC w/cc -Fswitch 689 I was using GCC V 1.21, G++ V 1.21.1, CC V 1.2. All compiles used '-O' as the only optimization switch. Now to be fair, it was more fun to use G++. It catches many more bugs than CC does. I did encounter two bugs in G++ which crashed the compiler, but they're being fixed. So, why is G++ slower than CC w/gcc? Good question. I'm going to try to enable various optional optimizations and see what I can find. I don't have any clues yet. If anyone has clues, please reply. The biggest single difference is between using GCC or PCC, with the second major difference being using the -f68881 flag. Dirk Grunwald Univ. of Illinois grunwald@m.cs.uiuc.edu