<?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>Visual-Experiments.com &#187; firefox</title>
	<atom:link href="http://www.visual-experiments.com/tag/firefox/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.visual-experiments.com</link>
	<description>ASTRE Henri experiments with Ogre3D and web stuff</description>
	<lastBuildDate>Mon, 16 Jan 2017 18:59:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Improving PhotoSynth extension performance</title>
		<link>http://www.visual-experiments.com/2012/03/19/improving-photosynth-extension-performance/</link>
		<comments>http://www.visual-experiments.com/2012/03/19/improving-photosynth-extension-performance/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 22:38:31 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[google chrome]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[photosynth]]></category>
		<category><![CDATA[three.js]]></category>
		<category><![CDATA[webgl]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=2150</guid>
		<description><![CDATA[I&#8217;ve recently discover the new transferable object feature in Google chrome. BTW transferable objects are really great! Furthermore you really should use them as I&#8217;ve found that structure cloning is leaking (you can try this leaking demo with chrome 17). Thus I&#8217;ve started to update my extension and done a benchmark of various solution with [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently discover the new <a href="http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast">transferable object</a> feature in Google chrome. BTW transferable objects are really great! Furthermore you really should use them as I&#8217;ve found that structure cloning is leaking (<a href="http://visual-experiments.com/demo/transfert/">you can try this leaking demo</a> with chrome 17). Thus I&#8217;ve started to update my extension and done a benchmark of various solution with a big synth of 20mo (1200k vertices and 1000 pictures). </p>
<p>I&#8217;ve also improved a lot my binary parsing by using only native binary parsing (<a href="https://developer.mozilla.org/en/JavaScript_typed_arrays/DataView">DataView</a>). One thing about DataView: <strong>did they realize that if you forgot the endianness parameter it will use BigEndian</strong>? <em>(littleEndian = x86, bigEndian = Motora 68k).</em></p>
<p>Thanks to both optimization <strong>the new version is 4x faster!</strong> (loading time: 24s > 6s)</p>
<h3>solution 1</h3>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/03/flow-11.jpg" alt="" title="flow-1" width="400" height="126" class="alignleft size-full wp-image-2186" /><br />
<br style="clear: both"/></p>
<ul>
<li>cross-orign was forbidden in contentscript (fixed now since chrome 13)</li>
<li>lack of TypedArray copy/transfert -> JS array replacement</li>
<li><strong>Loading time: 13600ms</strong> (24400ms with the previous version without optimized binary parsing)</li>
</ul>
<h3>solution 2</h3>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/03/flow-2.jpg" alt="" title="flow-2" width="300" height="82" class="alignleft size-full wp-image-2152" /><br />
<br style="clear: both"/></p>
<ul>
<li><strong>Issue:</strong> the UI is frozen during parsing (lack of threading)</li>
<li><strong>Loading time: 6500ms</strong></li>
</ul>
<h3>solution 3</h3>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/03/flow-3.jpg" alt="" title="flow-3" width="400" height="139" class="alignleft size-full wp-image-2153" /><br />
<br style="clear: both"/></p>
<ul>
<li>I&#8217;m using transferable objects to both send the xhr.response (ArrayBuffer) and receive the parsed Float32Array (vertex positions) and Uint8Array (vertex colors).</li>
<li><strong>Issue:</strong> I didn&#8217;t manage to spawn a worker from my extension directly (SECURITY_ERR: DOM Exception 18): I&#8217;ve been forced to <a href="http://blogs.microsoft.co.il/blogs/gilf/archive/2012/01/29/working-with-inline-web-workers.aspx">inline the worker</a> as a workaround.</li>
<li><strong>Loading time:  6000ms</strong></li>
</ul>
<h3>solution 4</h3>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/03/flow-4.jpg" alt="" title="flow-4" width="400" height="139" class="alignleft size-full wp-image-2154" /><br />
<br style="clear: both"/></p>
<ul>
<li><strong>Issue:</strong> because of <a href="http://code.google.com/p/chromium/issues/detail?id=45382">this bug</a> workers can not do cross-orign xhr.</li>
<li><strong>Loading time: N/A</strong></li>
</ul>
<p>I&#8217;ve also optimized the PLY file generation by generating binary file on the client side instead of ascii. </p>
<ul>
<li>Ascii: 74mo in 9000ms</li>
<li>Binary: 17mo in 530ms <strong>(~17x faster!)</strong></li>
</ul>
<p>Sadly I didn&#8217;t manage to find a way to accelerate <em>&#8220;bundle.out&#8221;</em> ascii file generation yet (involving lot of string concatenation and numbers formatting).</p>
<p><strong>I didn&#8217;t have updated the extension on the chrome web store yet</strong> as I&#8217;m working on using the new BufferGeometry of Three.js that should be more efficient. Building BufferGeometry directly from  Float32Array (vertex positions array) and Uint8Array (vertex colors array) seems a really better solution IMO.</p>
<h3>Mesh compression</h3>
<p>I&#8217;ve also discover the <a href="http://code.google.com/p/webgl-loader/">webgl-loader</a> mesh compression solution recently. I&#8217;ve compiled my own version of <a href="http://code.google.com/p/webgl-loader/source/browse/trunk/src/objcompress.cc">objcompress.cc</a> and fixed the JSON export. Then I&#8217;ve created my own format allowing to pack in one file all the utf8 files (thus reducing the number of http request needed). I will post about it soon: stay tuned!</p>
<h3>Firefox extension?</h3>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/02/screenshot2.jpg" alt="" title="Firefox extension" width="600" height="424" class="aligncenter size-full wp-image-2141" /><br />
On a side note I&#8217;ve also been playing with the new <a href="https://builder.addons.mozilla.org/">mozilla add-on builder SDK</a>&#8230; well IMO Firefox isn&#8217;t the best browser for extension anymore. I&#8217;ve been very disappointed by the restriction applied to code running in the contentscript (for example <a href="http://prototypejs.org/">prototype.js</a> is not working: I had to use a clone that I&#8217;ve built long time ago). And I&#8217;m also very concerned about their security strategy: they don&#8217;t have a cross-orign xhr permissions field in the manifest. Thus extensions can do cross-orign request to all domains by default! Nevertheless I&#8217;ve managed to port the binary parsing of the point cloud but Three.js is not working either <img src='http://www.visual-experiments.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> . </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2012%2F03%2F19%2Fimproving-photosynth-extension-performance%2F&amp;title=Improving%20PhotoSynth%20extension%20performance"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2012/03/19/improving-photosynth-extension-performance/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
