How to speed up programs by compiling



How can you make a program run faster by compiling?  I have tried to compile functions in pw.mac and it does not improve speed even 
though I thought it should.  For example I wrote a simple polynomial integrator program which I was going to put into pw.mac because 
I thought an integrate program that can only do polynomials would be faster than one that has to consider all possibilities but when 
I test it it is still slower the Maximas' integrate.  I tried compiling it and got no improvement.  What am I doing wrong?

Rich