<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Need help with this code for performance issue]]></title><description><![CDATA[<p>I write a little script, like the following</p>
<p>Creep.prototype.transferEnergyAndMove = function(mysource) {</p>
<pre><code>if(this.transferEnergy(mysource) == ERR_NOT_IN_RANGE) {
    var startCpu = Game.getUsedCpu();     
<pre><code>this.moveTo(mysource,{reusePath:9,serializeMemory:true});

var elapsed = Game.getUsedCpu() - startCpu;
console.log(' transferEnergyAndMove has used '+elapsed+' CPU time');   
</code></pre>
<p>}
</code></pre></p>
<p>};</p>
<p>and the results shock to me , <br> [10:13:57] transferEnergyAndMove has used 0.30031800000000075 CPU time<br> [10:13:59] transferEnergyAndMove has used 0.3367020000000007 CPU time<br> [10:14:02] transferEnergyAndMove has used 0.323207 CPU time<br> [10:14:05] transferEnergyAndMove has used 0.3165210000000016 CPU time<br> [10:14:07] transferEnergyAndMove has used 13.078899999999999 CPU time<br> [10:14:10] transferEnergyAndMove has used 0.3080759999999998 CPU time<br> [10:14:10] transferEnergyAndMove has used 1.7853649999999988 CPU time</p>
<p>What the terrible CPU time use like that 'transferEnergyAndMove has used 13.078899999999999 CPU time', how to do reduce this!? Any good methods to replace the moveTo() !?</p>]]></description><link>http://screeps.com/forum/topic/1296/need-help-with-this-code-for-performance-issue</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 08:28:24 GMT</lastBuildDate><atom:link href="http://screeps.com/forum/topic/1296.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 07 Nov 2015 14:18:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Need help with this code for performance issue on Invalid Date]]></title><description><![CDATA[<p>I write a little script, like the following</p>
<p>Creep.prototype.transferEnergyAndMove = function(mysource) {</p>
<pre><code>if(this.transferEnergy(mysource) == ERR_NOT_IN_RANGE) {
    var startCpu = Game.getUsedCpu();     
<pre><code>this.moveTo(mysource,{reusePath:9,serializeMemory:true});

var elapsed = Game.getUsedCpu() - startCpu;
console.log(' transferEnergyAndMove has used '+elapsed+' CPU time');   
</code></pre>
<p>}
</code></pre></p>
<p>};</p>
<p>and the results shock to me , <br> [10:13:57] transferEnergyAndMove has used 0.30031800000000075 CPU time<br> [10:13:59] transferEnergyAndMove has used 0.3367020000000007 CPU time<br> [10:14:02] transferEnergyAndMove has used 0.323207 CPU time<br> [10:14:05] transferEnergyAndMove has used 0.3165210000000016 CPU time<br> [10:14:07] transferEnergyAndMove has used 13.078899999999999 CPU time<br> [10:14:10] transferEnergyAndMove has used 0.3080759999999998 CPU time<br> [10:14:10] transferEnergyAndMove has used 1.7853649999999988 CPU time</p>
<p>What the terrible CPU time use like that 'transferEnergyAndMove has used 13.078899999999999 CPU time', how to do reduce this!? Any good methods to replace the moveTo() !?</p>]]></description><link>http://screeps.com/forum/post/5908</link><guid isPermaLink="true">http://screeps.com/forum/post/5908</guid><dc:creator><![CDATA[ggyyggyy]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Need help with this code for performance issue on Invalid Date]]></title><description><![CDATA[<p>Your only options would probably be to implement path caching or write your own pathing function. I've found caching to be effective most of the time.</p>]]></description><link>http://screeps.com/forum/post/5909</link><guid isPermaLink="true">http://screeps.com/forum/post/5909</guid><dc:creator><![CDATA[ThyReaper]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Need help with this code for performance issue on Invalid Date]]></title><description><![CDATA[<p>I'm sure you've figured this out by now, but moving takes a static .2 CPU time (the .3 is a little concerning).  The larger 13 is probably due to pathfinding.  As the previous poster said you could either roll your own path finder (although I believe it is faster now), or cache the results somehow.</p>]]></description><link>http://screeps.com/forum/post/5910</link><guid isPermaLink="true">http://screeps.com/forum/post/5910</guid><dc:creator><![CDATA[Hatyr]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>