Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sunybcs!boulder!ccncsu!ncr-fc!dona From: dona@ncr-fc.FtCollins.NCR.com (Don Allingham) Newsgroups: comp.lang.c++ Subject: stdio vs. streams Message-ID: Date: 18 Jan 90 20:44:22 GMT Sender: news@ncr-fc.FtCollins.NCR.COM Distribution: comp Organization: NCR Microelectronics, Ft. Collins, CO Lines: 61 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 main() { int i; for(i=0;i<=NUMBER;i++) printf("hello world, x = %d\n",1); } --------------------------- test #2 ---------------------------------- #include 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!dona