<?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>バカな火星人 &#187; Erlang</title>
	<atom:link href="http://martian.org/marty/tag/erlang/feed/" rel="self" type="application/rss+xml" />
	<link>http://martian.org/marty</link>
	<description>Marty was here!</description>
	<lastBuildDate>Wed, 11 Jan 2012 13:16:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>XML is a huge mess</title>
		<link>http://martian.org/marty/2009/09/30/xml-is-a-huge-mess/</link>
		<comments>http://martian.org/marty/2009/09/30/xml-is-a-huge-mess/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 16:27:28 +0000</pubDate>
		<dc:creator>Marty</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://martian.org/marty/?p=196</guid>
		<description><![CDATA[I have a 39 MB XML file that I wanted to process. I wasn&#8217;t expecting it to be so difficult. Writing the code, in multiple languages, was not difficult. But running the programs was a big problem. My first attempt was a simple Haskell program, but I had to kill it after it ate over [...]]]></description>
			<content:encoded><![CDATA[<p>I have a 39 MB XML file that I wanted to process.  I wasn&#8217;t expecting it to be so difficult.  Writing the code, in multiple languages, was not difficult.  But running the programs was a big problem.</p>

<p>My first attempt was a simple Haskell program, but I had to kill it after it ate over 1.3 GB (yes, 1.3 GB) of ram!</p>

<p>Haskell&#8217;s strings are known to be memory hogs, and the HaXml module I was using was making them even worse by not sensible decoding the UTF-8 text correctly.  I decided to write a leaner Haskell program later, and switch to Perl to get the job done.</p>

<p>At this point I also decided to set a limit to the amount of memory the programs could consume.  For a 39 MB file I hoped that 10 times that would be enough, so I rounded up and set the limit at 512 MB.</p>

<p>But Perl, using the XML::LibXML module, couldn&#8217;t process the file with that memory limit.  I also ran a quick one-liner in Erlang, just to watch it crash out of memory too.  I&#8217;m going to try some other languages to see if I can find one that can work in 512 MB.</p>

<p>My next useful step is to try the <a href="http://xmltwig.com/">XML::Twig</a> module in Perl.  I&#8217;ve had good experiences with it before.  It won&#8217;t be as fast as LibXML, but it probably has the best chance of surviving within my 512 MB limit.  For Haskell, I think I&#8217;ll have to resort to a SAX style parser.</p>
]]></content:encoded>
			<wfw:commentRss>http://martian.org/marty/2009/09/30/xml-is-a-huge-mess/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

