<?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>Hjælp mig nu &#187; Google</title>
	<atom:link href="http://blog.hjaelpmignu.dk/category/google/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hjaelpmignu.dk</link>
	<description>Hjælp til Adobes programmer</description>
	<lastBuildDate>Fri, 13 Jan 2012 11:28:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HTML5 canvas with JavaScript and Flash Player performance</title>
		<link>http://blog.hjaelpmignu.dk/2011/03/html5-canvas-with-javascript-and-flash-player-performance/</link>
		<comments>http://blog.hjaelpmignu.dk/2011/03/html5-canvas-with-javascript-and-flash-player-performance/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 21:47:35 +0000</pubDate>
		<dc:creator>ockley</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[www.hjaelpmignu.dk]]></category>
		<category><![CDATA[analasis]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[HTC Desire HD]]></category>
		<category><![CDATA[HTC Legend]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[Inspire 4G]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPad 2]]></category>
		<category><![CDATA[iPhone 3GS]]></category>
		<category><![CDATA[iPone 4]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://blog.hjaelpmignu.dk/?p=310</guid>
		<description><![CDATA[Link til dansk version This post is an examination of the performance provided by JavaScript and the canvas HTML element, and its role on mobile platforms in the future. The inspiration for this post came when I stumpled on Water Ripple Canvas by Almer Thies. It was running without problems (with Canvas: &#8230;<p><a href="http://blog.hjaelpmignu.dk/2011/03/html5-canvas-with-javascript-and-flash-player-performance/" class="more-link"><span>Continue Reading &#8594;</span></a></p>]]></description>
			<content:encoded><![CDATA[<div><a title="Link to danish version of the article" href="http://blog.hjaelpmignu.dk/2011/03/html5-canvas-med-javascript-og-flash-player-performance/">Link til dansk version</a></div>
<div>This post is an examination of the performance provided by JavaScript and the canvas HTML element, and its role on mobile platforms in the future. The inspiration for this post came when I stumpled on <a title="Water ripple canvas" href="http://code.almeros.com/code-examples/water-effect-canvas/">Water Ripple Canvas</a> by Almer Thies. It was running without problems (with Canvas: 20fps and Water: 30 fps) on my computer but was frighteningly slow with a max of 0.5 fps on my iPhone 4 (yep. A half frame per second!). I therefore found it relevant to produce a comparable piece of code that could run on the canvas element and easily port to Flash, so I could get an idea of how well each technology performed.</div>
<div>It is not a secret that I&#8217;m fond of the Adobe Flash Player, and have always believed that Apples excommunication of the player due performance issues had no standing ground, in light of the present alternatives. But HTML5 is a promising technology, that takes the job as website maker seriously again, and that may result in Flash being able to focus on it plug-in nature again, and help lift sites up above the tomorrows standard sites. The most important topic to discuss is: what should happen when our mobile visits a website in the month/years to come. Not distinguishing  between mobile and desktop would lead to sluggish performance on mobiles when canvas gets integrated in eager designers creative solutions &#8211; a future that I predict as the &#8220;big dip&#8221;, in the worst cases.</div>
<h3>Study 1</h3>
<div>The test case is the famous snowflake that are loved or hated by everyone. The effect is exclusively produced by code and can be scaled easily to increase the load on the processor. I found an example at <a href="http://blog.webreakstuff.com/2010/11/building-a-canvas-snowglobe/">http://blog.webreakstuff.com/2010/11/building-a-canvas-snowglobe/</a> by Pedro Freitas. The code can be found on GitHub via<a href=" https://gist.github.com/716215"> https://gist.github.com/716215</a>. I would also use an FPS counter, which could easily be ported to ActionScript and chose snippet from <a href="http://stackoverflow.com/questions/4787431/check-fps-in-js">http://stackoverflow.com/questions/4787431/check-fps-in-js</a></div>
<div>I need it to produce a working example of the FPS counter that can be found at <a title="canvas version of snow flake" href="http://eksempler.hjaelpmignu.dk/flash/actionscript/snowflake/snowcanvas.html">http://eksempler.hjaelpmignu.dk/flash/actionscript/snowflake/snowcanvas.html</a>. I have come to the following data (max is set to 100 FPS):</div>
<ul>
<li>Desktop PC:<strong> 99.9 </strong>FPS (Firefox)</li>
<li>MacBook Pro: <strong>97 - 98</strong> FPS (Safari)</li>
<li>iPad (iOS 4.3): <strong>19 - 20</strong> FPS <em>(updated 17/3 &#8211; 2011)</em></li>
<li>HTC Desire HD (2.2): <strong>15.5 - 16.5</strong> FPS</li>
<li>Inspire 4G (2.3): <strong>~ 14 </strong>FPS (updated 17/3 &#8211; 2011)</li>
<li>HTC Desire (2.2): <strong>14.4 - 14.7</strong> FPS</li>
<li>iPad 1 (iOS 4.3): <strong>13 &#8211; 13.5</strong> FPS (updated 17/3 &#8211; 2011)</li>
<li>iPad 1 (iOS 4.2): 1<strong>2.4 - 13.3 </strong>FPS</li>
<li>iPhone 4 (iOS 4.3): <strong>9.9 - 10.5</strong> FPS <em>(updated 17/3 &#8211; 2011)</em></li>
<li>iPhone 4 (iOS 4.2): <strong>9.9 - 10.3</strong> FPS</li>
<li>iPhone 3GS (iOS 4.2): <strong>9.9 - 10.3</strong> FPS</li>
<li>HTC Legend: <strong>7.5 - 8.9</strong> FPS</li>
</ul>
<div><em>Thanks to <a href="http://www.twitter.com/seb_ly/">@seb_ly</a> and <a href="http://www.twitter.com/leebrimelow/">@leebrimelow</a> for additional test results</em></div>
<div>When I dropped the restriction the PC actually easily spun on over 200 FPS, but the intention here is not to benchmark in the high end, but find a relationship in the &#8220;low end&#8221; and a relative measurement to a standard machine. PC as well as Mac differ so much on hardware as well as range of browsers, it will not contribute anything positive to uncover all facets.</div>
<h3>Conclusion 1</h3>
<div>It is evident that both computers frame rates hits the ceiling. The portable Mac has thrown a frame or two in the test, but will probably do 100 FPS in a another run, or with another browser. Of course it cannot run from a Quadro graphics card, but it&#8217;s clearly capable of running the test. iOS machines (iPad 1, iPhone 3GS and iPhone 4) has a hard time, to produce frames for the canvas element. On average, they just over 10 FPS.<br />
Desire HD is a bit higher. Not much, but still enough that it should be designated as a better settlement. Lowest is the HTC Legend, with around 8 fps.</div>
<h3>Study 2</h3>
<div>The second test was made to compare performance between javascripts work on the canvas, and Flash Player&#8217;s work with the BitmapData class. The technique used for both are very similar and it will give the best basis for comparison, and minimal editing of the code. You can see an example at <a href="http://eksempler.hjaelpmignu.dk/flash/actionscript/snowflake/snowFLA.html">http://eksempler.hjaelpmignu.dk/flash/actionscript/snowflake/snowFLA.html</a></div>
<div>The following changes have been made from the original code:</div>
<ul>
<li>Snow flakes was made as a separate class (Flake.as)</li>
<li>Updated variables, etc so they are strictly typed</li>
<li>Minor changes in variable names</li>
<li>Used Flash Player&#8217;s <em>flash.sensors.Accelerometer</em> to handle motion</li>
</ul>
<p>Flake.as</p>
<p>&nbsp;</p>
<p><code lang="actionscript3"> </code></p>
<pre><code lang="actionscript3">package 
{ 
import flash.display.Sprite; 
import flash.display.BitmapData; 

public class Flake extends Sprite 
{ 
private var canvasWidth; 
private var canvasHeight; 
private var speed: Number; 
private var alpha: Number; 
private var size: Number; 
private var amp: Number; 
private var shift: Number; 
private var range: Number; 

public function Flake (w, h, a, s) 
{ 
this.canvasWidth = w; 
this.canvasHeight = h; 
this.x = 200; 
this.y = Math.random () * -1 * h; 
this.alfa = Math.random () * 0.5 + a; 
this.speed = Math.random (); 
this.size = s - this.speed - this.alfa; 
this.amp = Math.random () * 2; 
this.shift = Math.random () * 25 + 25; 
if (Math.random ()&gt; 0.5) 
{ 
this.shift *= -1; 
} 
this.drift = Math.random () - 0.5; 
draw (); 
} 
public function draw (canvas: BitmapData = null): void 
{ 
this.graphics.beginFill (0xFFFFFF, this.alfa); 
this.graphics.drawCircle (0.0, this.size); 
this.graphics.endFill (); 
} 
public function move (f, wind): void 
{ 
this.y + = this.speed; 
this.x + = Math.cos (f / this.shift) * this.amp + + this.drift wind; 
if (this.y&gt; this.canvasHeight) 
{ 
this.restart (); 
} 
} 
public function restart (): void 
{ 
this.y = -20; 
this.shift = Math.random () * 25 + 25; 
this.x = 200; 
} 
} 
}</code></pre>
<p><code lang="actionscript3"> </code></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>MainApp.as</p>
<p><code lang="actionscript3"> </code></p>
<pre><code lang="actionscript3">package
{ 
import flash.display.Sprite; 
import flash.display.Bitmap; 
import flash.display.BitmapData; 
import flash.utils.Timer; 
import flash.events.TimerEvent; 
import flash.geom.Rectangle; 
import flash.geom.Matrix; 
import flashx.textLayout.elements.InlineGraphicElement; 
import flash.sensors.Accelerometer; 
import flash.events.AccelerometerEvent; 
import flash.text.TextField; 

public class MainApp extends Sprite 
{ 
private var bgflakes: Array = new Array (); 
private var fgflakes: Array = new Array (); 
private var bgFlakeCount: int = 200; 
private var fgFlakeCount: int = 50; 
private var frame count: int = 0; 
private var wind: int = 0; 
private var dWidth: int; 
private var dHeight: int; 
private var orientX: int = 1; 

private var bgBitmapData: BitmapData; 
private var bgCanvas: Bitmap; 
private var fgBitmapData: BitmapData; 
private var fgCanvas: Bitmap; 
private var timer: Timer; 
private var orientation: Boolean = false; 
private var myAcc: Accelerometer; 

private var filter Strength: int = 20; 
private var frame hours: int = 0; 
private var loading loop: Date = new Date (); 
private var this loop: Date = new Date (); 

private var fps: TextField; 

public function MainApp () 
{ 
init (); 
} 

private function init () 
{ 
dWidth = this.stage.stageWidth; 
dHeight = this.stage.stageHeight; 
bgBitmapData = new BitmapData (dWidth, dHeight, false, 0x000000); 
bgCanvas = new Bitmap (bgBitmapData); 
fgBitmapData = new BitmapData (dWidth, dHeight, true, 0xFF0000); 
fgCanvas = new Bitmap (fgBitmapData); 
addChild (bgCanvas); 
addChild (fgCanvas); 

fps = new TextField (); 
addChild (fps); 
fps.textColor = 0xFFFFFF; 

was i = 0; 
for (i = 0; i { 
bgflakes.push (New Flake (bgCanvas.width, bgCanvas.height, 0,3)); 
} 
for (i = 0; i { 
fgflakes.push (New Flake (fgCanvas.width, fgCanvas.height, 0.2,4)); 
} 
hours = new Timer (10); 
timer.addEventListener (TimerEvent.TIMER, draw); 
timer.start (); 

if (Accelerometer.isSupported) 
{ 
orientation = true; 
myAcc = new Accelerometer (); 
myAcc.addEventListener (AccelerometerEvent.UPDATE, onAccUpdate); 
} 
} 

private function onAccUpdate (e: AccelerometerEvent): void 
{ 
orientX = e.accelerationX; 
} 

private function setWind () 
{ 
if (! orientation) 
{ 
was mx: Number = mouseX - dWidth / 2; 
wind = (mx / dWidth) * 3; 
} 
lodging 
{ 
Wind = Number (orientX) * 3; 
} 
if (! wind) 
{ 
wind = 0; 
} 
} 

private function draw (e: Event hours) 
{ 
frame count + = 1; 

bgBitmapData.fillRect (new Rectangle (0.0, dWidth, dHeight), 0x000000); 
fgBitmapData = new BitmapData (dWidth, dHeight, true, 0xFF0000); 
setWind (); 
was: int = 0; 
for (i = 0; i { 
bgflakes [i]. move (frame count, wind); 

bgBitmapData.draw (bgflakes [i], new Matrix (1,0,0,1, bgflakes [i]. x, bgflakes [i]. y)); 
} 
for (i = 0; i { 
fgflakes [i]. move (frame count, wind); 

fgBitmapData.draw (bgflakes [i]); 
} 

was this frame hours: int = (Number (this loop = new Date ())) - Number (last loop); 
Frame hour + = (this frame - time frame hours) / filter strength; 
load loop = this loop; 
fps.text = (1000/frameTime). toFixed (1) + "fps"; 
} 
} 
}</code></pre>
<p><code lang="actionscript3"> </code></p>
<p>&nbsp;</p>
<div><strong>Comments on Code </strong></div>
<div><strong> </strong>I have kept the <em>draw () </em>inside the Flake class and draw the flakes with <em>graphics.drawCircle ()</em> to keep the code across the examples as similar as possible. The transfer of values on canvas size, etc. are also retained in the Flash version is also preserved. Finally, I used Bitmap () and BitmapData () to simulate the properties used on the canvas element.</div>
<h3>Results 2</h3>
<div>With mobile units, that is capable of running Flash Player 10.1 and canvas, I try to measure them against each other. Not as a battle, favoring one technology, for the future (I think) belongs to them both. It&#8217;s more an attempt to find out how bad Flash performs and supporters of the canvas as a &#8220;Flash Killer&#8221; has some back support. I&#8217;ll update as I stumple on different phones/tablets on my way:</div>
<ul>
<li>Dersire HD (2.2): Canvas <strong>~ 16.5</strong> FPS and Flash 10.1 <strong>~ 24.2</strong> FPS</li>
<li>Inspire 4G (2.3): Canvas <strong>~ 14 </strong>FPS and Flash 10.1 <strong>~ 22 </strong>FPS (updated 17/3 &#8211; 2011)</li>
<li>HTC Desire (2.2): Canvas <strong>~ 14.5</strong> FPS and Flash 10.1 <strong>21.7 to 23.5</strong> FPS</li>
</ul>
<div>You are welcome to submit own measurements</div>
<h3>Conclusion</h3>
<div>I get a relatively higher frame rate when running the test in Flash Player on Android than if I the canvas version. I wasn&#8217;t able to turn the relationship between the numbers on my phone, not even leveling the difference in frame rate. I therefore think that the user will have a better experience of this experiment in a flash player, than with a canvas version. It is important to remember that the canvas element&#8217;s ability to deliver, do not need to inflict on the general view on HTML5 and CSS3. My feeling is that CSS3 has a fairly good performance on the mobile devices, perhaps because of their predictable nature, but I haven&#8217;t investigated that topic yet.</div>
<div>Finally, I have not taken installed software on the devices into account. It may be relevant in a recount to look at parameters such as:</div>
<ul>
<li>How long the phone has been switched on.</li>
<li>Is it connected to the charger.</li>
<li>Programs running in the background.</li>
<li>Video documentation of test</li>
</ul>
<div>My point here is to get some numbers up in the air, and a comparison of material playd on mobile devices. Please reply with the results of your own measurements for computer, tablet and mobile.</div>
<div><strong>Links to tests: </strong></div>
<ul>
<li><a title="Canvas test working example og snow flake" href="http://eksempler.hjaelpmignu.dk/flash/actionscript/snowflake/snowcanvas.html">http://eksempler.hjaelpmignu.dk/flash/actionscript/snowflake/snowcanvas.html</a> (canvas)</li>
<li><a title="Adobe Flash player working example og snow flake" href="http://eksempler.hjaelpmignu.dk/flash/actionscript/snowflake/snowFLA.html">http://eksempler.hjaelpmignu.dk/flash/actionscript/snowflake/snowFLA.html</a> (Flash)</li>
</ul>
<div><strong>Links to documents </strong></div>
<ul>
<li><a title="Canvas test files" href="https://gist.github.com/716215">https://gist.github.com/716215</a> (canvas)</li>
<li><a title="Flash test files" href="http://eksempler.hjaelpmignu.dk/flash/actionscript/snowflake/snowFLA.zip">http://eksempler.hjaelpmignu.dk/flash/actionscript/snowflake/snowFLA.zip</a> (Flash)</li>
<li><a title="FPS measurement script" href="http://stackoverflow.com/questions/4787431/check-fps-in-js">http://stackoverflow.com/questions/4787431/check-fps-in-js</a> (Frame Counter)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.hjaelpmignu.dk/2011/03/html5-canvas-with-javascript-and-flash-player-performance/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Google Squared &#8211; en interessant søgemulighed</title>
		<link>http://blog.hjaelpmignu.dk/2009/06/google-squared-en-interessant-s%c3%b8gemulighed/</link>
		<comments>http://blog.hjaelpmignu.dk/2009/06/google-squared-en-interessant-s%c3%b8gemulighed/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 09:23:52 +0000</pubDate>
		<dc:creator>ockley</dc:creator>
				<category><![CDATA[Beta/Prerelease]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Tips og tricks]]></category>
		<category><![CDATA[www.hjaelpmignu.dk]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[google squares]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[search engines]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.hjaelpmignu.dk/?p=144</guid>
		<description><![CDATA[Jeg stødte i dag på Google Squared. Den ligger i deres laboratorium. Der ligger jo i forvejen en masse interessante ting, så vad er det lige der adskiller Squares fra det andet halløj. Google Squares giver dig mulighed for at inddele din søgning i rækker og kolonner, så du kan &#8230;<p><a href="http://blog.hjaelpmignu.dk/2009/06/google-squared-en-interessant-s%c3%b8gemulighed/" class="more-link"><span>Continue Reading &#8594;</span></a></p>]]></description>
			<content:encoded><![CDATA[<p>Jeg stødte i dag på <a href="http://www.google.com/squared">Google Squared</a>. Den ligger i deres <a href="http://www.googlelabs.com">laboratorium</a>. Der ligger jo i forvejen en masse interessante ting, så vad er det lige der adskiller Squares fra det andet halløj.</p>
<p>Google Squares giver dig mulighed for at inddele din søgning i rækker og kolonner, så du kan få et skema over resultatet. En søgning på Countries gav følgende:</p>
<div id="attachment_145" class="wp-caption alignnone" style="width: 564px"><img class="size-large wp-image-145" title="countries_result" src="http://blog.hjaelpmignu.dk/wp-content/uploads/2009/06/countries_result-1024x527.png" alt="Resultat af søgning på &quot;countries&quot;" width="554" height="285" /><p class="wp-caption-text">Resultat af søgning på &quot;countries&quot;</p></div>
<p>Google Squares opdeler det i relevante kolonner med navne, beskrivelser, hovedstæder osv. Hvis du vil have en specifik kolonne til at være synlig skal du bruge hårde parenteser i stil med &#8220;countries [popuplation]&#8220;. På den måde vil resultatet blive i stil med dette:</p>
<div id="attachment_146" class="wp-caption alignnone" style="width: 531px"><img class="size-large wp-image-146" title="countries_result2" src="http://blog.hjaelpmignu.dk/wp-content/uploads/2009/06/countries_result2-1024x412.png" alt="resultat med en specifik kolonne defineret" width="521" height="209" /><p class="wp-caption-text">resultat med en specifik kolonne defineret</p></div>
<p>En anden ting, der er interessant er at det nye resultat giver nogle andre indledende kolonner. Den kigger derfor resultatet igennem og finder ud af, hvilke kolonner der er relevante i søgeresultet.</p>
<p>TIP: Du kan selvfølgelig også skrive en kolonne i <strong>Add Columns</strong>, i resultatet.</p>
<p>Denne form for søgning giver et helt andet overblik end den normale søgning, og det bliver nemmere at opsamle og sidestille delementer af resultater i forhold til hinanden. Alle skolepligtige vil helt sikkert kunne nyde godt af værktøjet. Jeg får i hvertfald  mange sjove søgeaftener med denne utitlity &#8230; men igen. Jeg er også lidt underlig <img src='http://blog.hjaelpmignu.dk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Google Squared er stadig et eksperiment, så der er selvfølgelig mange tilføjelser man kunne ønske sig &#8230; meeen. Den er kommet godt ud af starthullerne. Hurra for Google</p>
<p>Prøv værktøjet på <a href="http://www.google.com/squared">http://www.google.com/squared</a> &#8211; god fornøjelse.</p>
<p>/ockley</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hjaelpmignu.dk/2009/06/google-squared-en-interessant-s%c3%b8gemulighed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

