<?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>Blog de desenvolvimento da Milfont Consulting, Client e Server-side &#187; High Performance</title>
	<atom:link href="http://www.milfont.org/tech/category/high-performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.milfont.org/tech</link>
	<description>Blog da Comunidade Milfont Consulting, uma empresa especializada em desenvolvimento Web, principalmente Javascript, node.js e muito Javascript.</description>
	<lastBuildDate>Thu, 26 Jan 2012 11:30:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Minificação de Javascript com Ant Task</title>
		<link>http://www.milfont.org/tech/2008/12/16/minificacao-de-javascript-com-ant-task/</link>
		<comments>http://www.milfont.org/tech/2008/12/16/minificacao-de-javascript-com-ant-task/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 20:06:34 +0000</pubDate>
		<dc:creator>cmilfont</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Engenharia de Software]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[High Performance]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Melhores práticas]]></category>
		<category><![CDATA[Otimização]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[YUI]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[ant task]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[minificação]]></category>
		<category><![CDATA[minified]]></category>

		<guid isPermaLink="false">http://www.milfont.org/tech/?p=459</guid>
		<description><![CDATA[Em um post passado eu falei da importância de unir e minificar arquivos js em determinados casos e discuti &#8220;quando&#8221; fazer isso, vou mostrar &#8220;como&#8221; minificar usando o YUI Compressor com tasks do Apache Ant montados por Viktor Lieskovsky do Javaflight. Esse pequeno tutorial-guia faz parte do material dos meus cursos de Javascript e Ajax [...]]]></description>
			<content:encoded><![CDATA[<p>Em um <a href="http://www.milfont.org/tech/2008/02/10/javascript-inline-e-external/">post passado</a> eu falei da importância de unir e minificar arquivos js em determinados casos e discuti &#8220;quando&#8221; fazer isso, vou mostrar &#8220;como&#8221; minificar usando o <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a> com tasks do <a href="http://ant.apache.org/">Apache Ant</a> <a href="http://code.google.com/p/javaflight-code/">montados por Viktor Lieskovsky</a> do <a href="http://javaflight.blogspot.com/">Javaflight</a>.</p>
<p>Esse pequeno tutorial-guia faz parte do material dos meus cursos de Javascript e Ajax e serve para deixar um histórico acessível aos alunos e fácil para leitores que por ventura precisem.</p>
<p>Preparei um ambiente de execução com todas as dependências no <a href="http://www.milfont.org/tech/projetos/">projeto</a> <a href="http://code.google.com/p/remendux/">Remendux</a> onde vocês podem fazer <a href="http://code.google.com/p/remendux/source/checkout">checkout</a> e rodar o build ant localmente como um projeto do eclipse &#8211; estou usando o plugin para o <a href="http://subclipse.tigris.org/">SVN Subclipse</a>.</p>
<p>Montei um script ant padrão bem simples de ser entendido por iniciantes:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jsmin&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;main&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- Propriedades para definir nomes de pastas que usaremos --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;js&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;js&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;lib&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;lib&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;output&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;output&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- Propriedades para definir nomes os arquivos necessários --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;yui-compressor.jar&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${lib}/yuicompressor-2.4.2.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;yui-compressor-ant-task.jar&quot;</span> </span>
<span style="color: #009900;">		<span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${lib}/yui-compressor-ant-task-0.3.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- Incluir as libs necessárias no classpath --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;task.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${yui-compressor.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${yui-compressor-ant-task.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- Definição da task para o Ant reconhecer --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taskdef</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;yui-compressor&quot;</span> </span>
<span style="color: #009900;"><span style="color: #000066;">classname</span>=<span style="color: #ff0000;">&quot;net.noha.tools.ant.yuicompressor.tasks.YuiCompressorTask&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;task.classpath&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/taskdef<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;clean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;output&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;output&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;main&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;clean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #808080; font-style: italic;">&lt;!-- Tag do Ant para concatenar arquivos </span>
<span style="color: #808080; font-style: italic;">		[ http://ant.apache.org/manual/CoreTasks/concat.html] </span>
<span style="color: #808080; font-style: italic;">		os arquivos são unidos na sequência de definição </span>
<span style="color: #808080; font-style: italic;">		no fileset</span>
<span style="color: #808080; font-style: italic;">		--&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;concat</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${output}/remendux.js&quot;</span> <span style="color: #000066;">force</span>=<span style="color: #ff0000;">&quot;no&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${js}/util.js&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${js}/remendux.js&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/concat<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #808080; font-style: italic;">&lt;!-- Task do yui-compressor --&gt;</span>
		 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;yui-compressor</span> <span style="color: #000066;">warn</span>=<span style="color: #ff0000;">&quot;false&quot;</span>  <span style="color: #000066;">munge</span>=<span style="color: #ff0000;">&quot;true&quot;</span>  </span>
<span style="color: #009900;">				<span style="color: #000066;">preserveallsemicolons</span>=<span style="color: #ff0000;">&quot;false&quot;</span> </span>
<span style="color: #009900;">				<span style="color: #000066;">fromdir</span>=<span style="color: #ff0000;">&quot;${output}&quot;</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${build}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/yui-compressor<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Após a importação, para executar o script &#8211; que chamei de build-yui.xml &#8211; basta apenas executar com o ant pelo eclipse &#8211; vide imagem abaixo &#8211; ou em linha de comando. Estou usando o Ant 7.1 com java 6u10 e Eclipse 3.4, portanto caso haja um erro atente para a versão das ferramentas usadas.</p>
<p><img src="http://www.milfont.org/tech/wp-content/uploads/2008/12/build.jpg" alt="" title="build"  class="aligncenter size-medium wp-image-464" /></p>
<p>Após executar, observe a redução de tamanho na versão minificada [../build/remendux-min.js] para a versão concatenada [../output/remendux.js ]. A versão final ficou com 30% do tamanho com documentação e identação.</p>

<div class="wp_syntax"><div class="code"><pre class="abap" style="font-family:monospace;">Buildfile<span style="color: #808080;">:</span> C<span style="color: #808080;">:</span>\workspace\remendux\build<span style="color: #808080;">-</span>yui<span style="color: #808080;">.</span>xml
     <span style="color: #808080;">&#91;</span>echo<span style="color: #808080;">&#93;</span> Building <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">output</span>
clean<span style="color: #808080;">:</span>
    <span style="color: #808080;">&#91;</span>mkdir<span style="color: #808080;">&#93;</span> Created dir<span style="color: #808080;">:</span> C<span style="color: #808080;">:</span>\workspace\remendux\build
    <span style="color: #808080;">&#91;</span>mkdir<span style="color: #808080;">&#93;</span> Created dir<span style="color: #808080;">:</span> C<span style="color: #808080;">:</span>\workspace\remendux\<span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">output</span>
main<span style="color: #808080;">:</span>
<span style="color: #808080;">&#91;</span>yui<span style="color: #808080;">-</span>compressor<span style="color: #808080;">&#93;</span>
 <span style="color: #808080;">&#91;</span><span style="color: #3399ff;">30</span><span style="color: #808080;">%</span><span style="color: #808080;">&#93;</span> remendux<span style="color: #808080;">.</span>js <span style="color: #808080;">&#91;</span><span style="color: #3399ff;">5775</span><span style="color: #808080;">&#93;</span> <span style="color: #808080;">---&gt;</span> <span style="color: #202020;">remendux</span><span style="color: #808080;">-</span><span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">min</span><span style="color: #808080;">.</span>js <span style="color: #808080;">&#91;</span><span style="color: #3399ff;">1734</span><span style="color: #808080;">&#93;</span>
<span style="color: #808080;">&#91;</span>yui<span style="color: #808080;">-</span>compressor<span style="color: #808080;">&#93;</span>
 <span style="color: #808080;">&#91;</span>JavaScript<span style="color: #808080;">&#93;</span> Compressed <span style="color: #3399ff;">1</span> files <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">to</span> <span style="color: #3399ff;">30</span><span style="color: #808080;">%</span> <span style="color: #808080;">&#40;</span>5KB <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">to</span> 1KB<span style="color: #808080;">,</span> saving 4KB<span style="color: #808080;">&#41;</span>
<span style="color: #808080;">&#91;</span>yui<span style="color: #808080;">-</span>compressor<span style="color: #808080;">&#93;</span>
 <span style="color: #808080;">&#91;</span>CSS<span style="color: #808080;">&#93;</span> <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">No</span> files <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">to</span> compress<span style="color: #808080;">,</span> <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">or</span> <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">all</span> files already <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">up to</span> <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">date</span>
<span style="color: #808080;">&#91;</span>yui<span style="color: #808080;">-</span>compressor<span style="color: #808080;">&#93;</span>
 Compressed <span style="color: #3399ff;">1</span> files <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">to</span> <span style="color: #3399ff;">30</span><span style="color: #808080;">%</span> <span style="color: #808080;">&#40;</span>5KB <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">to</span> 1KB<span style="color: #808080;">,</span> saving 4KB<span style="color: #808080;">&#41;</span>
BUILD SUCCESSFUL
Total <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">time</span><span style="color: #808080;">:</span> <span style="color: #3399ff;">12</span> <span style="color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;">seconds</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.milfont.org/tech/2008/12/16/minificacao-de-javascript-com-ant-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat: Rest in Peace?</title>
		<link>http://www.milfont.org/tech/2008/10/10/tomcat-rest-in-peace/</link>
		<comments>http://www.milfont.org/tech/2008/10/10/tomcat-rest-in-peace/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 16:42:42 +0000</pubDate>
		<dc:creator>cmilfont</dc:creator>
				<category><![CDATA[High Performance]]></category>
		<category><![CDATA[JEE]]></category>
		<category><![CDATA[Jetty]]></category>
		<category><![CDATA[Melhores práticas]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://www.milfont.org/tech/?p=326</guid>
		<description><![CDATA[Ultimamente tenho lido o depoimento de uma gama enorme de profissionais sobre os problemas de Memory Leak do Tomcat e alguns levantam a hipótese de uma possível descontinuação. Fábio Kung publicou no blog da Caelum sobre os problemas enfrentados pelo GUJ (maior e melhor fórum sobre Java e arquitetura de software do Brasil) de quedas [...]]]></description>
			<content:encoded><![CDATA[<p>Ultimamente tenho lido o depoimento de uma gama enorme de profissionais sobre os problemas de <a href="http://en.wikipedia.org/wiki/Memory_leak">Memory Leak</a> do <a href="http://tomcat.apache.org/">Tomcat</a> e alguns levantam a hipótese de uma possível descontinuação.</p>
<p><a href="http://fabiokung.com/">Fábio Kung</a> publicou no <a href="http://blog.caelum.com.br">blog da Caelum</a> sobre os <a href="http://blog.caelum.com.br/2008/06/27/melhorando-o-guj-jetty-nio-e-load-balancing/">problemas enfrentados pelo GUJ</a> (maior e melhor fórum sobre Java e arquitetura de software do Brasil) de quedas e lentidão. Há poucos dias o <a href="http://plentz.org/">Diego Plentz</a> também publicou <a href="http://plentz.org/2008/10/03/tomcat-is-deprecated/">sobre experiência recente</a>, até citando o artigo do Kung e dando explicações sobre as mudanças necessárias que teve que realizar nas aplicações durante a mudança do Tomcat para o <a href="http://www.mortbay.org/jetty/">Jetty</a>.</p>
<p>Na Java Magazine desse mês, <a href="http://www.milfont.org/tech/2008/09/30/java-magazine-ed-61/">edição 61</a>, o autor OSVALDO PINALI DOEDERLEIN &#8211; no artigo denominado &#8220;WTP 3.0 &#8211; Novidades do Ganymede para desenvolvimento Java EE&#8221; &#8211; escreveu no quadro: &#8220;Glassfish? Por que não Tomcat ou JBoss?&#8221;, o seguinte sobre o Tomcat:</p>
<blockquote><p><em>O projeto Apache Tomcat não me parece ir bem. O Tomcat 6 (versão atual) só teve dois builds estáveis: o release inicial de 2007 e um único update. Houve defecção de colaboradores importantes &#8220;como pessoal da Sun, realocado para o Glassfish quando este começou a levantar vôo, e para outros projetos como o LWUIT. Tecnologicamente o Tomcat parou no tempo há um par de anos. Fez a opção de reusar o APR (biblioteca de código nativo do Apache HTTPD), ao invés de investir forte no caminho &#8220;puro Java&#8221; de APIs como java.nio &#8211; opção que o Glassfish provou ser superior. Não tem havido atualizações de correção &amp; segurança com a regularidade que considero necessária para software dessa natureza. Continuo considerando o Tomcat uma boa opção apenas para ambientes onde toda a comunicação HTTP tem que passar pelo Apache HTTPD.</em></p>
<p>&#8230;.</p>
<p><em>É interessante observar que o Tomcat é o container web embutido no JBoss, e o JBoss é outro colaborador importante do projeto Tomcat. O que possivelmente indica que as dificuldades de ambos os projetos possam estar relacionadas.</em></p></blockquote>
<p>Com a <a href="http://fabiokung.com/2008/09/02/jetty-installed-base-growing/">onda crescente</a> do <a href="http://www.mortbay.org/jetty/">Jetty</a> sobre a base instalada do Tomcat é possível que nos próximos meses os retardatários movam seus sistemas jogando a última pá de terra.</p>
<p>E vocês? Já estão usando o Jetty em alternativa ao Tomcat?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.milfont.org/tech/2008/10/10/tomcat-rest-in-peace/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Compare a velocidade dos seus sites</title>
		<link>http://www.milfont.org/tech/2008/07/19/compare-a-velocidade-dos-seus-sites/</link>
		<comments>http://www.milfont.org/tech/2008/07/19/compare-a-velocidade-dos-seus-sites/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 19:48:27 +0000</pubDate>
		<dc:creator>cmilfont</dc:creator>
				<category><![CDATA[High Performance]]></category>
		<category><![CDATA[Melhores práticas]]></category>
		<category><![CDATA[Otimização]]></category>
		<category><![CDATA[web2.0]]></category>
		<category><![CDATA[Webslug]]></category>

		<guid isPermaLink="false">http://www.milfont.org/tech/2008/07/19/compare-a-velocidade-dos-seus-sites/</guid>
		<description><![CDATA[O Webslug é um serviço onde você pode comparar a velocidade de carregamento do seu site com outro qualquer, interessante para verificar dois sites hospedados no mesmo servidor e observar o carregamento afim de descobrir problemas se um sempre carregar mais rápido do que outro.]]></description>
			<content:encoded><![CDATA[<p>O <a href="http://www.webslug.info">Webslug</a> é um serviço onde você pode comparar a velocidade de carregamento do seu site com outro qualquer, interessante para verificar dois sites hospedados no mesmo servidor e observar o carregamento afim de descobrir problemas se um sempre carregar mais rápido do que outro.</p>
<p><img src="http://www.milfont.org/tech/wp-content/upload/webslug2.jpg" alt="Webslug logo" align="bottom" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.milfont.org/tech/2008/07/19/compare-a-velocidade-dos-seus-sites/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Javascript Inline e External</title>
		<link>http://www.milfont.org/tech/2008/02/10/javascript-inline-e-external/</link>
		<comments>http://www.milfont.org/tech/2008/02/10/javascript-inline-e-external/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 21:02:29 +0000</pubDate>
		<dc:creator>cmilfont</dc:creator>
				<category><![CDATA[High Performance]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Melhores práticas]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.milfont.org/tech/2008/02/10/javascript-inline-e-external/</guid>
		<description><![CDATA[Scripts internos (Inline) ao HTML agilizam em grande parte a exibição porque diminuem o número de requisições HTTP. Imagine que você tenha uma página com scripts separados: &#60;script &#8230; src=&#8221;script1.js&#8221;&#62;&#60;/script&#62; &#60;script &#8230; src=&#8221;script2.js&#8221;&#62;&#60;/script&#62; &#60;script &#8230; src=&#8221;script3.js&#8221;&#62;&#60;/script&#62; Nesse caso teremos 3 requisições além da página e sofreremos um aumento de até 50% no tempo de renderização. [...]]]></description>
			<content:encoded><![CDATA[<p>Scripts internos (<em>Inline</em>) ao HTML agilizam em grande parte a exibição porque diminuem o número de requisições HTTP.<br />
Imagine que você tenha uma página com scripts separados:</p>
<p>&lt;script &#8230; src=&#8221;script1.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script &#8230; src=&#8221;script2.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script &#8230; src=&#8221;script3.js&#8221;&gt;&lt;/script&gt;</p>
<p>Nesse caso teremos 3 requisições além da página e sofreremos um aumento de até 50% no tempo de renderização. Isso porque apesar do tamanho dos arquivos serem o mesmo se fossem internos, as múltiplas requisições provocam um overhead.</p>
<p>Ao invés dessa abordagem, se os scripts fossem internos, existiria uma única requisição HTTP e o tempo de renderização seria mais rápido.</p>
<p>O problema na abordagem de scripts internos é que não nos beneficiamos do cache.</p>
<h4 id="combinando-scripts">Combinando os scripts</h4>
<p>Uma alternativa é combinar todos os scripts para forçar apenas uma requisição e se beneficiar do cache.</p>
<p>Aliando a minificação do código, você reduz consideravelmente o tamanho do download do script. Observe que frameworks como o Extjs usam essa técnica, existe um arquivo <em><strong>ext-all.js</strong></em> que combina todos os componentes.</p>
<p>Para páginas que combinam um grande número de componentes e sofrem de elevado &#8220;<strong>Page Views</strong>&#8220;, é crucial o cache desses elementos em um único arquivo se beneficiando de poucas requisições HTTP e do uso do cache.</p>
<p>O problema nessa abordagem é que existem regiões com elevado &#8220;<strong>Page Views</strong>&#8221; que usam poucos componentes e tem que baixar todo o arquivo de uma só vez.</p>
<h4 id="download-demanda">Download sob demanda</h4>
<p>O melhor dos dois mundos é usar a estratégia de <strong>&#8220;Post-Onload Download&#8221;</strong> para os casos onde não há necessidade de baixar um script externo com todos os componentes. Nesse caso usamos a estratégia de <a href="http://www.milfont.org/tech/2007/10/08/script-tag/">Script tag</a> e baixamos apenas os módulos necessários a determinada região do sistema. O código do sistema será dividido em módulos.</p>
<pre language="javascript">var head = document.getElementsByTagName("head")[0];
var script = document.createElement('script');
script.id = 'ScriptOnDemand';
script.type = 'text/javascript';
script.src = url;
head.appendChild(script);</pre>
<p>Lembrando que essa técnica provoca uma aumento não só do esforço no desenvolvimento (porque você terá que administrar as dependências entre os componentes manualmente) como do tempo de manutenção no código (por dividir os scripts em módulos apropriados).</p>
<h4 id="conclusao">Conclusão</h4>
<p>Faça poucas requisições HTTP para uma mesma página. Diminua sempre o número de requisições unindo todos os scripts em um único arquivo.</p>
<p>Caso o arquivo seja grande para uma página, adote a estratégia de subir os arquivos sob demanda.</p>
<p>A recomendação da estratégia adotada vai depender da métrica de cada região do seus sitema e do custo de esforço na administração desse código.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.milfont.org/tech/2008/02/10/javascript-inline-e-external/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

