[Sunhelp] C++ compiler options
mjohnson at forsythemca.com
mjohnson at forsythemca.com
Mon Mar 13 22:58:54 CST 2000
--0__=moxKNnknF4mjbmUcDqESzGIbWbZxR9t9BcHjoowq41q8DcjRsLo7poGf
Content-type: text/plain; charset=us-ascii
Content-Disposition: inline
All,
I have not used the SUN Visual Workshop for C++ or a C++ compiler lately. I
have a development group asking me what switches and options to use to optimize
performance. I hope you can help.
Secondly, the same development group has written the following code reading a
text file that has 128 characters per record (numerical data) as attached. The
puzzling thing is that it runs in 0.19s when the system calls and screen output
are commented out, and it runs in 1min 12s with system calls and screen output
in. I am not as familiar with the code since I have not written any for quite
some time. Again, I hope you can help.
Thanks in advance,
Marc
(See attached file: BENCHMRK.C)
--0__=moxKNnknF4mjbmUcDqESzGIbWbZxR9t9BcHjoowq41q8DcjRsLo7poGf
Content-type: application/octet-stream;
name="BENCHMRK.C"
Content-Disposition: attachment; filename="BENCHMRK.C"
Content-transfer-encoding: base64
I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8Y3R5cGUuaD4NCiNpbmNsdWRlIDxzdGRsaWIu
aD4NCiNpbmNsdWRlIDxzdHJpbmcuaD4NCiNpbmNsdWRlIDxpb3N0cmVhbS5oPg0KI2luY2x1ZGUg
PGZzdHJlYW0uaD4NCg0Kc3RydWN0IEJEUiB7DQoJY2hhciBzekRhdGFbMTUxXTsNCgljaGFyIGZp
bGw7DQoJY2hhciBuZXdsaW5lOw0KfTsNCg0KRklMRSAJKklucHV0RmlsZTsNCmNoYXIJc3pGaWxl
TmFtZVs0NV07DQpzdHJ1Y3QgCUJEUglCRFJmbDsNCmludAkJbENEUlNpemUgPSAxNTM7DQpsb25n
CWxGaWxlU2l6ZSA9IDA7DQpsb25nCWxUb3RhbENEUnMgPSAwOw0KbG9uZwlsUG9zID0gMDsNCg0K
dm9pZCByZWFkRmlsZSgpOw0Kdm9pZCBPcGVuTG9nRmlsZShjb25zdCBjaGFyKik7DQoNCmludCBt
YWluKHZv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