9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] 8c -v- gcc
@ 2002-02-27 12:28 steve.simon
  0 siblings, 0 replies; 2+ messages in thread
From: steve.simon @ 2002-02-27 12:28 UTC (permalink / raw)
  To: 9fans

Hi,

My contribution to the debate.

My machine is a 400Mhz PII laptop with 128Mbyte RAM,
it dual boots NT4 and Plan9.

gcc runs under WinNT using the Cygwin emulation
enviroment (sorry that is what I have) and is version 2.95.3-5.

Plan9 runs as a standalone machine under kfs, using ape.

I compiled cputimes.c off netlib and had to up the number of rounds to get
reliable results. Ironically I had to then reduce the number of rounds in
the push()/pop() tests as this test caused plan9 to thrash its disk -
swapping I assume.

The results look OK, nothing startling to my eyes, gcc is a
bit faster but not shockingly so. The only surprise is the
difference in strcpy() but perhaps this one is in C rather
than asm in Plan9.

Numbers with a query after them had too wide a varience in the tests
and so are "dubious". For more info look at the cputimes source.

-Steve

Operation               gcc     gcc-O3  Plan9
  {}                    0.0130  0.0050  0.0061?
  i1++              0.0018  0.0058? 0.0049?
  i1 = i2 + i3          0.0020  0.0024  0.0056
  i1 = i2 - i3          0.0022  0.0026  0.0066
  i1 = i2 * i3          0.0040  0.0034  0.0042
  i1 = i2 / i3          0.0851  0.0877  0.0842
  i1 = i2 % i3          0.0835  0.0913  0.0844
  f1 = f2               0.0042  0.0012? 0.0027?
  f1 = f2 + f3          0.0024  0.0024  0.0049
  f1 = f2 - f3          0.0032  0.0026  0.0049
  f1 = f2 * f3          0.0034  0.0026  0.0049
  f1 = f2 / f3          0.0845  0.0875  0.0715
  i1 = f1               0.1154  0.1230  0.0895
  f1 = i1               0.0072  0.0080  0.0061
  v[i] = i              0.0283  0.0361  0.0351
  v[v[i]] = i           0.0547  0.0555  0.0398
  v[v[v[i]]] = i            0.0605  0.0561  0.0544
  if (i == 5) i1++      0.0038  0.0056  0.0059
  if (i != 5) i1++      0.0040  0.0080  0.0061
  while (i < 0) i1++        0.0036  0.0074? 0.0061?
  i1 = sum1(i2)         0.0248  0.0010? 0.0183
  i1 = sum2(i2, i3)     0.0309  0.0026  0.0266
  i1 = sum3(i2, i3, i4)     0.0369  0.0046  0.0317
  fputs(s, fp)          0.6498  0.6418  0.3717
  fgets(s, 9, fp)           0.5018  0.5020  0.3355
  fprintf(fp, sdn, i)       3.4040  3.3196  2.4135
  fscanf(fp, sd, &i1)       1.1928  1.1588  0.8743
  free(malloc(8))           1.1386  1.1170  0.1159
  push(i)               0.8100  0.7950  0.7739
  i1 = pop()            0.6880  0.6370  0.3599
  strcpy(s, s0123456789)    0.1050  0.1048  0.3198
  i1 = strcmp(s, s)     0.0855  0.0845  0.2147
  i1 = strcmp(s, sa123456789)   0.0621  0.0581  0.0373
  i1 = atoi(s12345)     0.4090  0.3970  0.4099
  sscanf(s12345, sd, &i1)   1.1670  1.1570  0.9679
  sprintf(s, sd, i)     2.3710  2.3770  2.0919
  f1 = atof(s123_45)        0.6490  0.6170  0.4579
  sscanf(s123_45, sf, &f1)  1.5890  1.6170  1.4819
  sprintf(s, sf62, 123.45)  6.2350  5.5430  6.0919
  i1 = rand()           0.0832  0.0812  0.0475
  f1 = log(f2)          0.6640  0.6338  0.6037
  f1 = exp(f2)          0.9022  0.7722  0.7719
  f1 = sin(f2)          0.9444  0.8762  0.6451
  f1 = sqrt(f2)         2.9052  0.1652  0.9841


----------------------------------------------------------------------
The contents of this communication are confidential to the normal user of
the email address to which it was sent.  If you have received this email
in error, any use, dissemination, forwarding, printing or copying of this
email is strictly prohibited.  If this is the case, please notify the
sender and delete this message.
---------------------------------------------------------------------- 



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] 8c -v- gcc
@ 2002-02-28  5:42 David Gordon Hogan
  0 siblings, 0 replies; 2+ messages in thread
From: David Gordon Hogan @ 2002-02-28  5:42 UTC (permalink / raw)
  To: 9fans

>  free(malloc(8))           1.1386  1.1170  0.1159

I just thought that this line needed to be highlighted.
We may not have the world's best code generation,
but our memory allocator's an order of magnitude
faster!

C:/cygwin/usr/src/cygwin-1.3.2-1/newlib/libc/stdlib/mallocr.c:
* Why use this malloc?

  This is not the fastest, most space-conserving, most portable, or
  most tunable malloc ever written. However it is among the fastest
  while also being among the most space-conserving, portable and tunable.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-28  5:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-27 12:28 [9fans] 8c -v- gcc steve.simon
2002-02-28  5:42 David Gordon Hogan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).