<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Compiling Localizable Objects into Native JavaScript</title>
	<atom:link href="http://blog.mozilla.com/seth/2009/08/25/compiling-localizable-objects-into-native-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.com/seth/2009/08/25/compiling-localizable-objects-into-native-javascript/</link>
	<description>localization and community at mozilla</description>
	<lastBuildDate>Tue, 07 Jun 2011 10:48:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Axel Hecht</title>
		<link>http://blog.mozilla.com/seth/2009/08/25/compiling-localizable-objects-into-native-javascript/comment-page-1/#comment-143262</link>
		<dc:creator>Axel Hecht</dc:creator>
		<pubDate>Thu, 27 Aug 2009 22:41:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/seth/?p=550#comment-143262</guid>
		<description>Re native LOL parser, there is a rather strong force within our platform drivers to not use native code unless ultimately needed. Both for attack surface and for maintainance.</description>
		<content:encoded><![CDATA[<p>Re native LOL parser, there is a rather strong force within our platform drivers to not use native code unless ultimately needed. Both for attack surface and for maintainance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Kaiser</title>
		<link>http://blog.mozilla.com/seth/2009/08/25/compiling-localizable-objects-into-native-javascript/comment-page-1/#comment-143256</link>
		<dc:creator>Robert Kaiser</dc:creator>
		<pubDate>Thu, 27 Aug 2009 18:50:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/seth/?p=550#comment-143256</guid>
		<description>I wonder if we could just write a native LOL parser based on the native JSON parser we have - i.e. do real (token-based?) parsing of the LOL instead of just regular expressions.</description>
		<content:encoded><![CDATA[<p>I wonder if we could just write a native LOL parser based on the native JSON parser we have &#8211; i.e. do real (token-based?) parsing of the LOL instead of just regular expressions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Hiatt</title>
		<link>http://blog.mozilla.com/seth/2009/08/25/compiling-localizable-objects-into-native-javascript/comment-page-1/#comment-143216</link>
		<dc:creator>Jeremy Hiatt</dc:creator>
		<pubDate>Wed, 26 Aug 2009 18:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/seth/?p=550#comment-143216</guid>
		<description>Thanks to both of you for your suggestions.

@Laurens: We considered doing something like that, which would certainly help. However, as long as we&#039;re doing a preprocessing step, we might as well do as much as we possibly can to improve performance at runtime, and we got a huge boost by dropping regex replacement entirely. TraceMonkey (Mozilla&#039;s new JS engine) currently can&#039;t handle nontrivial regex replacement in an optimal manner, though hopefully &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=460904&quot; rel=&quot;nofollow&quot;&gt;this bug&lt;/a&gt; will get fixed soon. In our case, converting the replacement operation to a string concatenation made our code about 40x faster in the evaluation step.

@Daniel: Thanks for the offer! As I mentioned above, we don&#039;t have performance-critical regex operations any more. That said, it would be useful to make our l20n &quot;interpreter&quot; faster.

The regex to match our expander syntax looks like this:
/\$\{([^\}]+)\}(i&#124;s)/

It gets used as follows:
complex_string_to_expand.replace(/\$\{([^\}]+)\}(i&#124;s)/g, replacement)

where &#039;replacement&#039; is a function to evaluate expressions and look up entity references that appear inside the curly braces.

If you see any room for improvement, please let me know!</description>
		<content:encoded><![CDATA[<p>Thanks to both of you for your suggestions.</p>
<p>@Laurens: We considered doing something like that, which would certainly help. However, as long as we&#8217;re doing a preprocessing step, we might as well do as much as we possibly can to improve performance at runtime, and we got a huge boost by dropping regex replacement entirely. TraceMonkey (Mozilla&#8217;s new JS engine) currently can&#8217;t handle nontrivial regex replacement in an optimal manner, though hopefully <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=460904" rel="nofollow">this bug</a> will get fixed soon. In our case, converting the replacement operation to a string concatenation made our code about 40x faster in the evaluation step.</p>
<p>@Daniel: Thanks for the offer! As I mentioned above, we don&#8217;t have performance-critical regex operations any more. That said, it would be useful to make our l20n &#8220;interpreter&#8221; faster.</p>
<p>The regex to match our expander syntax looks like this:<br />
/\$\{([^\}]+)\}(i|s)/</p>
<p>It gets used as follows:<br />
complex_string_to_expand.replace(/\$\{([^\}]+)\}(i|s)/g, replacement)</p>
<p>where &#8216;replacement&#8217; is a function to evaluate expressions and look up entity references that appear inside the curly braces.</p>
<p>If you see any room for improvement, please let me know!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Einspanjer</title>
		<link>http://blog.mozilla.com/seth/2009/08/25/compiling-localizable-objects-into-native-javascript/comment-page-1/#comment-143192</link>
		<dc:creator>Daniel Einspanjer</dc:creator>
		<pubDate>Wed, 26 Aug 2009 00:38:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/seth/?p=550#comment-143192</guid>
		<description>If you are still using regular expressions in a performance sensitive context, please point them out and I&#039;d be happy to help optimize them.</description>
		<content:encoded><![CDATA[<p>If you are still using regular expressions in a performance sensitive context, please point them out and I&#8217;d be happy to help optimize them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurens Holst</title>
		<link>http://blog.mozilla.com/seth/2009/08/25/compiling-localizable-objects-into-native-javascript/comment-page-1/#comment-143182</link>
		<dc:creator>Laurens Holst</dc:creator>
		<pubDate>Tue, 25 Aug 2009 19:28:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/seth/?p=550#comment-143182</guid>
		<description>You could preprocess the JSON objects and insert flags to indicate whether a string has a variable in it… that would save you from doing unnecessary regular expression tests at run-time.</description>
		<content:encoded><![CDATA[<p>You could preprocess the JSON objects and insert flags to indicate whether a string has a variable in it… that would save you from doing unnecessary regular expression tests at run-time.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

