public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Optimization Advice for beginer?
@ 2006-02-06  1:29 wodderwing1 (sent by Nabble.com)
  2006-02-08  3:38 ` Barry Andrews
  2006-02-08  4:32 ` wodderwing1 (sent by Nabble.com)
  0 siblings, 2 replies; 3+ messages in thread
From: wodderwing1 (sent by Nabble.com) @ 2006-02-06  1:29 UTC (permalink / raw)
  To: gcc-help


I am in a second level college programing class, and we have to make a maze solving program, and we are graded on how much time out program uses to produce a optimal solution.  I have done just about everything I can to optimize my code, my program takes  0.055 seconds to complete all of the test cases, but I need to run a little faster.

 I was wondering if you know any good optimization flags that I can use that would increase perfomance. I am using stack and queue data strutures. Also, I do not know what type of machine, or "Autograder" will compile and grade my code, but I am allowed to submit my own makefile.

Here is my current make file:

"


.SUFFIXES: .o .cpp

OBJS = prog.o maize.o 
#CC = g++ -Wall
#CC = g++ -g -Wall
CC = g++ -O3 -Wall -O -funroll-loops 
AR       = ar cr

all : $(OBJS) UTIL/libutil.a
	$(CC) -o MortimerMaze $(OBJS) UTIL/libutil.a

UTIL/libutil.a:
	cd $(PWD)/UTIL; make PWD=$(PWD)/UTIL

clean:
	rm -rf *.o MortimerMaze
	cd $(PWD)/UTIL; make PWD=$(PWD)/UTIL clean

.cpp.o:
	$(CC) -c $*.cpp
	
	 
"

--
View this message in context: http://www.nabble.com/Optimization-Advice-for-beginer--t1066651.html#a2774684
Sent from the gcc - Help forum at Nabble.com.

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

* Re: Optimization Advice for beginer?
  2006-02-06  1:29 Optimization Advice for beginer? wodderwing1 (sent by Nabble.com)
@ 2006-02-08  3:38 ` Barry Andrews
  2006-02-08  4:32 ` wodderwing1 (sent by Nabble.com)
  1 sibling, 0 replies; 3+ messages in thread
From: Barry Andrews @ 2006-02-08  3:38 UTC (permalink / raw)
  To: gcc-help, wodderwing1

Well... I find it interesting that you are relying on the compiler to 
optimize. Usually the first place to look at is your code. 

But anyway... looking at your compiler options, I think you have pretty much 
done everything you can. Maybe optimizing for a particular processor is an 
option for you?

-Barry



On Sunday 05 February 2006 08:29 pm, wodderwing1 (sent by Nabble.com) wrote:
> I am in a second level college programing class, and we have to make a maze
> solving program, and we are graded on how much time out program uses to
> produce a optimal solution.  I have done just about everything I can to
> optimize my code, my program takes  0.055 seconds to complete all of the
> test cases, but I need to run a little faster.
>
>  I was wondering if you know any good optimization flags that I can use
> that would increase perfomance. I am using stack and queue data strutures.
> Also, I do not know what type of machine, or "Autograder" will compile and
> grade my code, but I am allowed to submit my own makefile.
>
> Here is my current make file:
>
> "
>
>
> .SUFFIXES: .o .cpp
>
> OBJS = prog.o maize.o
> #CC = g++ -Wall
> #CC = g++ -g -Wall
> CC = g++ -O3 -Wall -O -funroll-loops
> AR       = ar cr
>
> all : $(OBJS) UTIL/libutil.a
> 	$(CC) -o MortimerMaze $(OBJS) UTIL/libutil.a
>
> UTIL/libutil.a:
> 	cd $(PWD)/UTIL; make PWD=$(PWD)/UTIL
>
> clean:
> 	rm -rf *.o MortimerMaze
> 	cd $(PWD)/UTIL; make PWD=$(PWD)/UTIL clean
>
> .cpp.o:
> 	$(CC) -c $*.cpp
>
>
> "
>
> --
> View this message in context:
> http://www.nabble.com/Optimization-Advice-for-beginer--t1066651.html#a27746
>84 Sent from the gcc - Help forum at Nabble.com.

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

* Re: Optimization Advice for beginer?
  2006-02-06  1:29 Optimization Advice for beginer? wodderwing1 (sent by Nabble.com)
  2006-02-08  3:38 ` Barry Andrews
@ 2006-02-08  4:32 ` wodderwing1 (sent by Nabble.com)
  1 sibling, 0 replies; 3+ messages in thread
From: wodderwing1 (sent by Nabble.com) @ 2006-02-08  4:32 UTC (permalink / raw)
  To: gcc-help


The compiler flags helped, and I also made my data structure a little larger so that I would have to do less conditional tests. That change seemed to make the biggest difference.
--
View this message in context: http://www.nabble.com/Optimization-Advice-for-beginer--t1066651.html#a2815468
Sent from the gcc - Help forum at Nabble.com.

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

end of thread, other threads:[~2006-02-08  4:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-06  1:29 Optimization Advice for beginer? wodderwing1 (sent by Nabble.com)
2006-02-08  3:38 ` Barry Andrews
2006-02-08  4:32 ` wodderwing1 (sent by Nabble.com)

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 read-only IMAP folder(s) and NNTP newsgroup(s).