Re: Programming Shootout: reverse-complement

new topic     » goto parent     » topic index » view thread      » older message » newer message

Salix wrote:
> 
> James W Hofmann wrote:
> > 
> > We seem pretty close to filling up all the benchmarks in the Programming 
> > Shootout. 
> 
> I don't know how close you are as the last entry in the archive is from 
> Jason and dated 02/06. Anyway I highly support the idea and to show my 
> appreciation let me provide you the following masterpiece. smile))
> 

Here's a quick optimization of that (took out subscripting, and cached
a couple of recomputed values).  I get about a 30-40% improvement:

atom res1, res2, res3, res4, res5, res6, res7, res8, res9
res1 = 0.0
res2 = 0.0
res3 = 0.0
res4 = 0.0
res5 = 0.0
res6 = 0.0
res7 = 0.0
res8 = 0.0
res9 = 0.0
atom temp
for k=1 to N by 1 do
	res1+=power((2/3),k-1)
	res2+=power(k,-0.5)
	res3+=1/(k*(k+1))
	temp = 1/(power(k,3)*power(sin(k),2))
	res4+=temp
	res5+=temp
 	res6+=1/k
 	res7+=1/power(k,2)
 	temp = power(-1,k+1)
 	res8+=temp/k
 	res9+=temp/(2*k-1)
end for


new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu