<?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: Haskell Performance: Lowercase</title>
	<atom:link href="http://www.brool.com/index.php/haskell-performance-lowercase/feed" rel="self" type="application/rss+xml" />
	<link>http://www.brool.com/index.php/haskell-performance-lowercase</link>
	<description>brool \brool\ (n.) : a low roar; a deep murmur or humming</description>
	<lastBuildDate>Wed, 01 Sep 2010 18:04:13 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: dons</title>
		<link>http://www.brool.com/index.php/haskell-performance-lowercase/comment-page-1#comment-74200</link>
		<dc:creator>dons</dc:creator>
		<pubDate>Sun, 29 Mar 2009 06:54:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.brool.com/?p=266#comment-74200</guid>
		<description>I think you&#039;re running into the fact it is using Unicode toLower.

Look in GHC.Unicode.toLower, and it is in terms of:

foreign import ccall unsafe &quot;u_towlower&quot;
  towlower :: CInt -&gt; CInt

So you&#039;re calling out to C each time.

An ascii only version should be faster, e.g.,

toLower c@(C# c#)
  &#124; isAsciiUpper c = C# (chr# (ord# c# +# 32#))
  &#124; isAscii c      = c
  &#124; isUpper c      = unsafeChr (ord c `minusInt` ord &#039;A&#039; `plusInt` ord &#039;a&#039;)
  &#124; otherwise      =  c

or your version.</description>
		<content:encoded><![CDATA[<p>I think you&#8217;re running into the fact it is using Unicode toLower.</p>
<p>Look in GHC.Unicode.toLower, and it is in terms of:</p>
<p>foreign import ccall unsafe &#8220;u_towlower&#8221;<br />
  towlower :: CInt -&gt; CInt</p>
<p>So you&#8217;re calling out to C each time.</p>
<p>An ascii only version should be faster, e.g.,</p>
<p>toLower c@(C# c#)<br />
  | isAsciiUpper c = C# (chr# (ord# c# +# 32#))<br />
  | isAscii c      = c<br />
  | isUpper c      = unsafeChr (ord c `minusInt` ord &#8216;A&#8217; `plusInt` ord &#8216;a&#8217;)<br />
  | otherwise      =  c</p>
<p>or your version.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
