<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Werx Limited &#187; performance</title>
	<atom:link href="http://werxltd.com/wp/tag/performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://werxltd.com/wp</link>
	<description>We make IT work.</description>
	<lastBuildDate>Thu, 29 Jul 2010 19:00:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Cleaning up unresponsive script errors</title>
		<link>http://werxltd.com/wp/2009/07/03/cleaning-up-unresponsive-script-errors/</link>
		<comments>http://werxltd.com/wp/2009/07/03/cleaning-up-unresponsive-script-errors/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 18:58:13 +0000</pubDate>
		<dc:creator>wes</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[javascript optimization]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[unresponsive script error]]></category>

		<guid isPermaLink="false">http://werxltd.com/wp/?p=85</guid>
		<description><![CDATA[I recently worked on improving performance in a labor scheduling application. The app was originally designed to load all the employees at one time in one large chunk, processing and stuffing the data into various places as needed on startup. This all worked fairly well on average stores with 50-100 employee records until we discovered [...]]]></description>
			<content:encoded><![CDATA[<p>I recently worked on improving performance in a labor scheduling application. The app was originally designed to load all the employees at one time in one large chunk, processing and stuffing the data into various places as needed on startup. This all worked fairly well on average stores with 50-100 employee records until we discovered several stores with 100+ employee records which caused the browser to display an <a href="http://somewhatfrank.typepad.com/photos/uncategorized/yahoo_unresponsive_script_1.jpg">unresponsive script warning</a> due to the rather heavy pre-processing algorithms.</p>
<p>After scouring the web for clues to help me get rid of this warning without <a href="http://lifehacker.com/162574/put-off-firefox-15s-unresponsive-script-dialogue">changing settings</a> on the browser, I found out that the only way to avoid these warnings was through a pseudo-threading pattern using setTimeout<sup>1</sup><sup>2</sup>.</p>
<p>One of the patterns I came up with to process a sequence of commands (such as adding records to a store) one at a time while still allowing the browser time to refresh and process other commands:</p>
<pre class="brush:javascript">var chainedTasks = [
   function() {
      console.log('first set of tasks');
   },
   function() {
      console.log('second set of tasks');
   },
   function() {
      console.log('third set of tasks');
   }
];

var currentTaskNum = 0;
var isExecuting = false;
var emptask = {var emptask = {
	scope: this,
	interval: 100,
	run: function(){
		if(currentTaskNum &gt; chainedTasks.length) {
			Ext.TaskMgr.stop(emptask);
		}

		if (!threadIsRunning) {
			threadIsRunning = true;
			if (typeof chainedTasks[currentTaskNum] === 'function') {
				chainedTasks[currentTaskNum](currentTaskNum);
			}
			currentTaskNum++;
			threadIsRunning = false;
		}
	}
};
Ext.TaskMgr.start(emptask);</pre>
<ol class="footnotes"><li id="footnote_0_85" class="footnote"><a href="http://www.dojotoolkit.org/forum/support/general-support/need-suggestions-how-manage-firefox-warning-unresponsive-script">http://www.dojotoolkit.org/forum/support/general-support/need-suggestions-how-manage-firefox-warning-unresponsive-script</a></li><li id="footnote_1_85" class="footnote"><a href="http://dev.opera.com/articles/view/efficient-javascript/?page=all">http://dev.opera.com/articles/view/efficient-javascript/?page=all</a></li></ol>]]></content:encoded>
			<wfw:commentRss>http://werxltd.com/wp/2009/07/03/cleaning-up-unresponsive-script-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multi-threading in Web 2.0</title>
		<link>http://werxltd.com/wp/2009/06/10/multi-threading-in-web-20/</link>
		<comments>http://werxltd.com/wp/2009/06/10/multi-threading-in-web-20/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 19:21:22 +0000</pubDate>
		<dc:creator>wes</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[multi threading]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://werxltd.com/wp/?p=54</guid>
		<description><![CDATA[I've been tasked with speeding up a web 2.0 application based on ExtJS 2.2.0 that contains several routines that take up quite a bit of time and, because IE6's javascript processing engine is less than stellar ((In other words, it sucks pretty bad.)), I needed to find a way to "speed things up".]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been tasked with speeding up a web 2.0 application based on ExtJS 2.2.0 that contains several routines that take up quite a bit of time and, because <a href="http://technologytales.com/2007/06/22/ie6-and-javascript-performance/">IE6&#8242;s javascript processing engine is less than stellar</a><sup>1</sup>, I needed to find a way to &#8220;speed things up&#8221;.</p>
<p>Enter <a href="http://extjs.com/deploy/dev/docs/?class=Ext.TaskMgr">Ext.TaskMgr</a>, a helpful ExtJS object that is essentially a glorified <a href="http://www.w3schools.com/htmldom/met_win_settimeout.asp">setTimeout</a> implementation that allows us to run tasks that don&#8217;t block execution. This means we can set our more expensive blocks of code to run later but return control back to the user in the meantime. It&#8217;s not true multi-threading, but it does allow us to make the user interface a lot more responsive and in an age when users think 5 seconds is an eternity, <a href="http://msdn.microsoft.com/en-us/library/bb288452.aspx">perception is everything</a>.</p>
<ol class="footnotes"><li id="footnote_0_54" class="footnote">In other words, it sucks pretty bad.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://werxltd.com/wp/2009/06/10/multi-threading-in-web-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
