Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool2.mu.edu!sol.ctr.columbia.edu!cica!news.cs.indiana.edu!shirley@iuvax.cs.indiana.edu From: shirley@iuvax.cs.indiana.edu (peter shirley) Newsgroups: comp.lang.c++ Subject: Re: why is this program slow? Message-ID: <1991Jan9.113134.26637@news.cs.indiana.edu> Date: 9 Jan 91 06:31:03 GMT References: <1991Jan9.002244.23398@news.cs.indiana.edu> <14167@ulysses.att.com> Organization: Computer Science, Indiana University Lines: 18 Several people on this group and by mail suggested I needed a += operation for vectors. I tried this, and on our vax it got the C++ code to be as fast as the C code. On a sparc, it was as fast with "big-O" turned off, but the C code was much better with the optimizer on. Maybe cc was smart enough to change something like: a = 0; for (i=0; i < 1000000; i++) a = a + 1; to: a = 1000000; Anyway, things are working great now. Thank you all for the quick help! pete shirley