dona@ncr-fc.FtCollins.NCR.com (Don Allingham) (01/19/90)
Playing with Sun C++ 2.0, I have encountered an interesting
statistic. It seams as if the streams package is about 1/2 as fast as
the stdio package. This is a pretty significant drawback, especially
in file translators. The two cases I used are :
--------------------------- test # 1 ---------------------------------
#include <stdio.h>
main()
{
int i;
for(i=0;i<=NUMBER;i++)
printf("hello world, x = %d\n",1);
}
--------------------------- test #2 ----------------------------------
#include <stream.h>
main()
{
int i;
for(i=0;i<=NUMBER;i++)
cout << "hello world, x = "<< 1 << "\n";
}
The results (on a Sun 3/60, SunOS 4.0.3) are:
Sun C, test #1
---------------
time printf > out
33.1 real 11.5 user 1.5 sys
Sun CC, test #1
---------------
time printfCC > out
29.9 real 11.3 user 1.8 sys
Sun CC, test #2
---------------
time stream > out
44.5 real 23.7 user 2.3 sys
What is going on? Shouldn't they be at least comparable? Are streams
really that slow?
--
Don Allingham
NCR Microelectronics ncr-fc!bach!dona@ccncsu.colostate.edu
Ft. Collins, CO. uunet!ncrlnk!ncr-sd!ncr-fc!bach!donadona@ncr-fc.FtCollins.NCR.com (Don Allingham) (01/19/90)
On 18 Jan 90 20:44:22 GMT,
dona@ncr-fc.FtCollins.NCR.com (Don Allingham) said:
Don> #include <stdio.h>
Don> main()
Don> {
Don> int i;
Don> for(i=0;i<=NUMBER;i++)
Don> printf("hello world, x = %d\n",1);
Don> }
I forgot to mention that in both cases, NUMBER was defined to be
100000 from the command line.
--
Don Allingham
NCR Microelectronics ncr-fc!bach!dona@ccncsu.colostate.edu
Ft. Collins, CO. uunet!ncrlnk!ncr-sd!ncr-fc!bach!dona