<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><description /><title>Tenerife Skunkworks</title><generator>Tumblr (3.0; @wagerlabs)</generator><link>http://wagerlabs.com/</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/TenerifeSkunkworks" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>Links for 2009-11-06 [del.icio.us]</title><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/qkrNITcuNEQ/wagerlabs</link><pubDate>Sat, 07 Nov 2009 00:00:00 PST</pubDate><guid isPermaLink="false">http://del.icio.us/wagerlabs#2009-11-06</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://chrismiles.livejournal.com/25648.html"&gt;chrismiles: Python 3.0 on Mac OS X with readline&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://x264dev.multimedia.cx/?p=201"&gt;Diary Of An x264 Developer &amp;raquo; The other hidden cycle-eating demon: code cache misses&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://honeypod.blogspot.com/2007/12/dynamically-linked-hello-world-for.html"&gt;motz diary: Dynamically linked &amp;quot;Hello, world!&amp;quot; for Android&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://honeypod.blogspot.com/2007/12/initialize-libc-for-android.html"&gt;motz diary: Initialize libc for Android.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://honeypod.blogspot.com/2007/12/shared-library-hello-world-for-android.html"&gt;motz diary: Shared library &amp;quot;Hello World!&amp;quot; for Android&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://honeypod.blogspot.com/2008/01/debug-native-application-for-android.html"&gt;motz diary: Debug a Native Application for Android&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.dpfiles.com/dpfileswiki/index.php?title=Black%5FArt%5Fof%5F3D%5FGame%5FProgramming%2C%5FChapter%5F10:%5F3D%5FFundamentals"&gt;Black Art of 3D Game Programming, Chapter 10: 3D Fundamentals - Dpfileswiki&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/qkrNITcuNEQ" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/wagerlabs#2009-11-06</feedburner:origLink></item><item><title>Links for 2009-11-03 [del.icio.us]</title><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/5MtUCBxFl4o/wagerlabs</link><pubDate>Wed, 04 Nov 2009 00:00:00 PST</pubDate><guid isPermaLink="false">http://del.icio.us/wagerlabs#2009-11-03</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://wildebeests.wordpress.com/2009/10/11/using-mathematica-to-create-a-daily-list-of-trade-weight-index-data/"&gt;Using Mathematica to create a daily list of Trade Weight Index data &amp;laquo; Wildebeests&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/5MtUCBxFl4o" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/wagerlabs#2009-11-03</feedburner:origLink></item><item><title>Tracking IO patterns in memory-mapped dynamic libaries</title><description>&lt;p&gt;The Mac OSX dynamic linker uses &lt;a href="http://en.wikipedia.org/wiki/Mmap"&gt;mmap&lt;/a&gt; to load dynamic libraries into memory. The memory range
occupied by the libraries is then backed by a set of virtual memory pages, chunks of 4096 bytes each.&lt;/p&gt;

&lt;p&gt;Using &lt;a href="http://en.wikipedia.org/wiki/Mmap"&gt;mmap&lt;/a&gt; is efficient because pages are lazily loaded from disk as needed and the virtual memory pager is free to evict them behind the scenes when memory is needed for something else.&lt;/p&gt;

&lt;p&gt;Each page is filled with code for functions that live in the dynamic library and pages are fetched from disk when a call is made to a function in the dynamic library.&lt;/p&gt;

&lt;p&gt;Pages should be accessed sequentially for best performance but how do you find out if this is the case? The only way to find out is to plug into the virtual memory manager and track when pages backing a particular dynamic library are paged-in from disk.&lt;/p&gt;

&lt;p&gt;This is doable but a tad complicated as it requires access to internal kernel structures. As always, &lt;a href="http://en.wikipedia.org/wiki/DTrace"&gt;DTrace&lt;/a&gt; comes to the rescue! Note that the &lt;a href="http://github.com/wagerlabs/firefox-startup/blob/master/page-fault.d"&gt;following DTrace script&lt;/a&gt; will only work on Snow Leopard. Let’s take it apart and see how it works…&lt;/p&gt;

&lt;p&gt;First we define a an alias for an internal kernel type. This is not necessary but saves on typing.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;typedef struct nameidata* nameidata_t;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A dynamic library is usually opened with a call to &lt;em&gt;dlopen&lt;/em&gt;. The first argument (arg0) is the library path.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pid$target::dlopen:entry
/arg0/
{
  self-&gt;ppath = arg0;
  self-&gt;dylib = 1;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The Mac OSX dynamic linker (dyld) does not use &lt;em&gt;dlopen&lt;/em&gt; on dynamic libraries, though, so we need to do different.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pid$target::dyld??loadPhase5*:entry,
pid$target::dyld??loadPhase4*:entry
/!self-&gt;dylib &amp;&amp; arg0/
{
  self-&gt;path = copyinstr(arg0);
  self-&gt;func = probefunc;
  self-&gt;dylib = 1;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We want to trigger subsequent probes only if we entered via one of the two entry points above. We need to reset the flag once we return and this is what we do below.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pid$target::dlopen:return
{
  self-&gt;dylib = 0;
}

pid$target::dyld??loadPhase5*:return,
pid$target::dyld??loadPhase4*:return
/self-&gt;func != 0 &amp;&amp; self-&gt;func == probefunc/
{
  self-&gt;dylib = 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It often happens that memory we want to access in DTrace is not available at the function entry point. This is what happens sometimes with the &lt;em&gt;dlopen&lt;/em&gt; entry probe. The &lt;em&gt;open&lt;/em&gt; call is triggered by &lt;em&gt;dlopen&lt;/em&gt; so we can copy the file path into kernel space using the &lt;em&gt;self-&gt;ppath&lt;/em&gt; pointer we saved earlier.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/* file name memory should be wired in by now */

pid$target::open:entry
/self-&gt;dylib &amp;&amp; self-&gt;ppath &amp;&amp; self-&gt;path == 0/
{
  self-&gt;path = copyinstr(self-&gt;ppath);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The Mac OSX virtual memory manager identifies a file by its &lt;a href="http://en.wikipedia.org/wiki/Inode"&gt;virtual node (vnode)&lt;/a&gt; in the virtual filesystem (VFS) layer. We need to somehow match up the dynamic library name with its &lt;em&gt;vnode&lt;/em&gt; and this is where the &lt;em&gt;vn_open_auth&lt;/em&gt; entry probe comes in.&lt;/p&gt;

&lt;p&gt;Note that unlike the DTrace &lt;em&gt;pid$target&lt;/em&gt; provider we used before, we use the &lt;a href="http://wikis.sun.com/display/DTrace/fbt+Provider"&gt;Function Boundary Tracing (FBT)&lt;/a&gt; provider since the virtual filesystem layer lives in the kernel.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;fbt::vn_open_auth:entry
{
  self-&gt;ndp = (nameidata_t)arg0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This clause is not absolutely necessary but I’m populating &lt;em&gt;self-&gt;curpath&lt;/em&gt; as a shortcut, to be used a few times in later probes.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/* wait to make sure ndp and vnode are fully populated */

fbt::vn_open_auth:return
/self-&gt;path != 0/
{
  self-&gt;curpath = stringof((self-&gt;ndp)-&gt;ni_pathbuf);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It’s not obvious how to best match up a &lt;em&gt;vnode&lt;/em&gt; with a file name so I cheated and studied the &lt;a href="http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/"&gt;XNU kernel source code&lt;/a&gt; which Apple makes available. The &lt;em&gt;vnode&lt;/em&gt; is not populated until &lt;em&gt;vn_open_auth&lt;/em&gt; returns so we have to wait until it happens fo fetch the path.&lt;/p&gt;

&lt;p&gt;We are almost done with our task, just need to save the library name and library path to &lt;em&gt;vnode&lt;/em&gt; mappings if our library names match.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/* make sure we are opening the same file */

fbt::vn_open_auth:return
/self-&gt;curpath != 0 &amp;&amp; self-&gt;path == self-&gt;curpath/
{
  this-&gt;vp = (vnode_t)(self-&gt;ndp)-&gt;ni_vp;
  this-&gt;lib = stringof((this-&gt;vp)-&gt;v_name);
  self-&gt;lib[this-&gt;lib] = self-&gt;path;
  self-&gt;vnode[this-&gt;lib] = this-&gt;vp; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We do need to clean up sometime and so we do.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;fbt::vn_open_auth:return
{
  self-&gt;path = 0;
  self-&gt;ppath = 0;
  self-&gt;curpath = 0;
  self-&gt;ndp = 0;
  self-&gt;func = 0;
  self-&gt;dylib = 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We use the same &lt;a href="http://wikis.sun.com/display/DTrace/fbt+Provider"&gt;function boundary tracing (fbt)&lt;/a&gt; DTrace provider to track page-ins. We print the file offset of the data we are paging in, as well as the size.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;fbt::vnode_pagein:entry
{
  self-&gt;v_name = stringof(((vnode_t)arg0)-&gt;v_name);
}

/* vnode pointers should match but v_name seems more secure */

fbt::vnode_pagein:entry
/self-&gt;lib[self-&gt;v_name] != 0/
{
  printf("vnode_pagein: %s, offset: %u, size: %u\n", 
    self-&gt;v_name, arg3, arg4);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It does look from &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=524202#c2"&gt;the output&lt;/a&gt; that we are loading multiple pages at the same time, e.g. size 1019904 corresponds to 249 pages. Page access looks quite random, though, which is killing us.&lt;/p&gt;

&lt;p&gt;Now that we know what the access pattern is, we should try to first identify the symbols that are being accessed in each set of pages and then &lt;a href="http://developer.apple.com/mac/library/documentation/Performance/Conceptual/CodeFootprint/Articles/ImprovingLocality.html#//apple_ref/doc/uid/20001862"&gt;make the linker rearrange the code&lt;/a&gt; such that page access is more sequential and less random.&lt;/p&gt;

&lt;p&gt;Note that you are not likely to see page-ins when running this DTrace script unless you have just restarted your Mac and are running Firefox for the first time. This is because the dynamic libraries will be stored in the &lt;a href="http://www.usenix.org/publications/library/proceedings/usenix2000/freenix/full_papers/silvers/silvers_html/"&gt;Unified Buffer Cache (UBC)&lt;/a&gt; after first access and there won’t be any subsequent disk access until they are evicted from the cache.&lt;/p&gt;

&lt;p&gt;I wrote about &lt;a href="http://tinyco.de/2008/03/04/hacking-the-unified-buffer-cache.html"&gt;hacking the Unified Buffer Cache&lt;/a&gt; before but the same technique does not work with mmap-ed data since the virtual manager and the cache are the same thing. Evicting the libraries would involve allocating at at least twice as much virtual memory as there’s RAM and then touching each page to make sure it’s cached. This is unlikely to correspond to normal use of Firefox, though.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/KxDYTRC2Scc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/KxDYTRC2Scc/230853261</link><guid isPermaLink="false">http://wagerlabs.com/post/230853261</guid><pubDate>Mon, 02 Nov 2009 15:21:07 +0000</pubDate><category>firefox</category><category>performance</category><category>optimization</category><category>mac</category><feedburner:origLink>http://wagerlabs.com/post/230853261</feedburner:origLink></item><item><title>Links for 2009-10-31 [del.icio.us]</title><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/KKqk5f1et7g/wagerlabs</link><pubDate>Sun, 01 Nov 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wagerlabs#2009-10-31</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.mobileorchard.com/apple-approved-iphone-inter-process-communication/"&gt;Apple Approved iPhone Inter-process Communication&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/KKqk5f1et7g" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/wagerlabs#2009-10-31</feedburner:origLink></item><item><title>Links for 2009-10-24 [del.icio.us]</title><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/NYgBI_qB0sU/wagerlabs</link><pubDate>Sun, 25 Oct 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wagerlabs#2009-10-24</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.lisphacker.com/projects/sbcl-arm/port-log.txt"&gt;A Log of an Attempt to Port SBCL to Linux on the ARM Architecture&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/NYgBI_qB0sU" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/wagerlabs#2009-10-24</feedburner:origLink></item><item><title>Links for 2009-10-20 [del.icio.us]</title><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/g4p4Z79z1fg/wagerlabs</link><pubDate>Wed, 21 Oct 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wagerlabs#2009-10-20</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.datawrangling.com/python-montage-code-for-displaying-arrays"&gt;Python Montage Code for Displaying Arrays &amp;raquo; Data Wrangling Blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://techguyinmidtown.com/2009/02/16/pythonic-data-analysis-with-maskedarray-and-timeseries/#comments"&gt;Pythonic Data Analysis with MaskedArray and Timeseries &amp;laquo; tech guy in midtown&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/g4p4Z79z1fg" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/wagerlabs#2009-10-20</feedburner:origLink></item><item><title>Links for 2009-10-15 [del.icio.us]</title><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/n-lvuouMiDk/wagerlabs</link><pubDate>Fri, 16 Oct 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wagerlabs#2009-10-15</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://blog.wolfram.com/2009/10/15/wolfram-research-at-the-fall-2009-american-chemical-society-national-meeting-and-exposition/"&gt;All property information for a single chemical summarized as a table&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://fly.srk.fer.hr/~unreal/theredbook/"&gt;OpenGL Programming Guide (Addison-Wesley Publishing Company): Table of Contents&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/n-lvuouMiDk" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/wagerlabs#2009-10-15</feedburner:origLink></item><item><title>Links for 2009-10-14 [del.icio.us]</title><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/t7ErZhN00wU/wagerlabs</link><pubDate>Thu, 15 Oct 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/wagerlabs#2009-10-14</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.nthcode.com/pubs/porting-android-to-a-new-device.html"&gt;NthCode - Porting Android to a New Device&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://discuz-android.blogspot.com/2008/01/manually-start-android-in-google.html"&gt;Manually start android in the google android emulator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://discuz-android.blogspot.com/2008/01/customize-google-android-systemimg-for.html"&gt;Customize google android system.img for emulator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://discuz-android.blogspot.com/2008/01/step-by-step-to-createmodify-ramdiskimg.html"&gt;Let's talk about Google Android: Step by step to create/modify ramdisk.img&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html"&gt;Dalvik opcodes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Main_Page"&gt;Main Page - Mathematica-users&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/skia/w/list"&gt;Wiki Pages - skia - Project Hosting on Google Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/android-dalvik-vm-on-java/"&gt;android-dalvik-vm-on-java - Project Hosting on Google Code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/t7ErZhN00wU" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/wagerlabs#2009-10-14</feedburner:origLink></item><item><title>My Firefox for Mac startup optimization log</title><description>&lt;a href="https://wiki.mozilla.org/Firefox/Projects/Startup_Time_Improvements/joelr_notes"&gt;My Firefox for Mac startup optimization log&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/5ifTxu-2Rzg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/5ifTxu-2Rzg/212819609</link><guid isPermaLink="false">http://wagerlabs.com/post/212819609</guid><pubDate>Wed, 14 Oct 2009 13:40:40 +0100</pubDate><category>firefox</category><category>performance</category><category>mac</category><feedburner:origLink>http://wagerlabs.com/post/212819609</feedburner:origLink></item><item><title>My notes on Firefox for Android</title><description>&lt;a href="https://wiki.mozilla.org/User:Joel_Reymont/Android_Notes"&gt;My notes on Firefox for Android&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/KjDmtyGxx1k" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/KjDmtyGxx1k/212818328</link><guid isPermaLink="false">http://wagerlabs.com/post/212818328</guid><pubDate>Wed, 14 Oct 2009 13:38:39 +0100</pubDate><category>android</category><category>firefox</category><feedburner:origLink>http://wagerlabs.com/post/212818328</feedburner:origLink></item><item><title>Automated Trading Resources | Flirting wiht Models</title><description>&lt;a href="http://coreyhoffstein.com/automated-trading-resources/"&gt;Automated Trading Resources | Flirting wiht Models&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/pKYB4nJI94g" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/pKYB4nJI94g/205072695</link><guid isPermaLink="false">http://wagerlabs.com/post/205072695</guid><pubDate>Mon, 05 Oct 2009 15:17:50 +0100</pubDate><category>trading</category><feedburner:origLink>http://wagerlabs.com/post/205072695</feedburner:origLink></item><item><title>Erlang and high-frequency trading</title><description>&lt;a href="http://groups.google.com/group/erlang-programming/browse_thread/thread/97fe15af680debfc"&gt;Erlang and high-frequency trading&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/hxUTDT4sysY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/hxUTDT4sysY/201978987</link><guid isPermaLink="false">http://wagerlabs.com/post/201978987</guid><pubDate>Thu, 01 Oct 2009 21:11:06 +0100</pubDate><feedburner:origLink>http://wagerlabs.com/post/201978987</feedburner:origLink></item><item><title>"I knew a Chinese guy who came to the US with his mom, dad, and sis. They all worked at a Chinese..."</title><description>“&lt;p&gt;I knew a Chinese guy who came to the US with his mom, dad, and sis. They all worked at a Chinese buffet and shared an apartment with another family (that’s like 8 people in a 2 bedroom apartment!).&lt;/p&gt;

&lt;p&gt;Anyway, since they could eat for free at the buffet, their rent was cheap, and they didn’t do anything but work, every month each family member could save around $1000 (so $4K total).&lt;br/&gt;
And so in a year they had $48K saved up! &lt;/p&gt;

&lt;p&gt;They did this for 4 years and then had enough to open their own buffet restaurant. And from the looks of it they’re doing quite well. They have a huge house now and luxury cars and stuff.&lt;/p&gt;”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;&lt;a href="http://www.reddit.com/r/programming/comments/9jacy/has_anyone_here_successfully_launched_a_start_up/"&gt;http://www.reddit.com/r/programming/comments/9jacy/has_anyone_here_successfully_launched_a_start_up/&lt;/a&gt;&lt;/em&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/NfQDpeSEghY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/NfQDpeSEghY/186842234</link><guid isPermaLink="false">http://wagerlabs.com/post/186842234</guid><pubDate>Sun, 13 Sep 2009 12:04:22 +0100</pubDate><feedburner:origLink>http://wagerlabs.com/post/186842234</feedburner:origLink></item><item><title>Where does time go?</title><description>&lt;p&gt;The dyld shared cache lives in &lt;em&gt;/var/db/dyld/&lt;/em&gt;. The two files of interest are &lt;em&gt;dyld_shared_cache_i386.map&lt;/em&gt; (for x86-32) and &lt;em&gt;shared_region_roots/Applications.paths&lt;/em&gt;. Both are regular text files. The former shows the contents of the shared cache for the i386 architecture and the latter is what &lt;em&gt;update_dyld_shared_cache&lt;/em&gt; inspects.&lt;/p&gt;

&lt;p&gt;There’s no prebinding on newer versions of Mac OSX and the dyld shared cache is
automatically updated as needed. Tracing Safari disk activity during startup
reveals that basically all its dynamic libraries are pulled from the dyld
shared cache.&lt;/p&gt;

&lt;p&gt;It’s possible to add Firefox (&lt;em&gt;…/Firefox.app/Contents/MacOS/firefox-bin&lt;/em&gt;) to
&lt;em&gt;Applications.paths&lt;/em&gt; and the change will persist across reboots. Unfortunately,
only a handful of libraries that Firefox uses are pulled into the cache by
&lt;em&gt;update_dyld_shared_cache&lt;/em&gt;. I’m speculating that this may have something to do
with @executable_path/XUL and friends (otool -L …/firefox-bin).&lt;/p&gt;

&lt;p&gt;Safari uses absolute paths to frameworks in &lt;em&gt;/System/Library/Frameworks&lt;/em&gt; so I
speculate that relative paths are what is preventing XUL and others from going
into the cache.&lt;/p&gt;

&lt;p&gt;It’s possible to fix relative library paths in a given library, e.g. &lt;em&gt;fix.sh XUL&lt;/em&gt; where &lt;em&gt;fix.sh&lt;/em&gt; looks like this&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash 

function dylibs () {
  otool -L $1 |grep executable_path|awk '{print $1}'|cut -d"/" -f2
}

for i in `dylibs $1`
do
        install_name_tool -change @executable_path/$i `pwd`/$i $1
done

install_name_tool -id `pwd`/$1 $1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Firefox has to be recompiled with &lt;em&gt;LDFLAGS=-header-pad_max_install_names&lt;/em&gt;_ in &lt;em&gt;MOZCONFIG&lt;/em&gt; to make this happen since new library paths are greater than the space allocated in the Mach-O binary. See the man page for &lt;em&gt;install_name_tool&lt;/em&gt; for details.&lt;/p&gt;

&lt;p&gt;It’s possible to force dynamic libraries into the cache by putting dynamic library paths into &lt;em&gt;shared_region_roots/Applications.paths&lt;/em&gt; instead of executables. I wasn’t successful in caching XUL, though, regardless of what I did. XUL is &lt;em&gt;the&lt;/em&gt; Firefox dynamic library, it doesn’t even have a dylib extension.&lt;/p&gt;

&lt;p&gt;In the end it doesn’t seem to matter since there’s a baffling lack of difference between Firefox and Safari cold stats, despite Safari pulling everything from the cache and Firefox using a large number of non-cached dylibs.&lt;/p&gt;

&lt;p&gt;Here’s the cold startup stats for Safari&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sync &amp;&amp; purge &amp;&amp; DYLD_PRINT_STATISTICS=1 /Applications/Safari.app/Contents/MacOS/Safari
total time: 696.9 milliseconds (100.0%)
total images loaded:  116 (114 from dyld shared cache, 114 needed no fixups)
total segments mapped: 5, into 30 pages with 10 pages pre-fetched
total images loading time: 204.9 milliseconds (29.4%)
total rebase fixups:  1,298
total rebase fixups time: 0.1 milliseconds (0.0%)
total binding fixups: 2,476
total binding symbol lookups: 234, average images searched per symbol: 1.6
total binding fixups time: 80.5 milliseconds (11.5%)
total bindings lazily fixed up: 3 of 901
total init time time: 411.3 milliseconds (59.0%)
total images with weak exports:  1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and Firefox&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;total time: 731.2 milliseconds (100.0%)
total images loaded:  106 (93 from dyld shared cache, 56 needed no fixups)
total segments mapped: 49, into 5903 pages with 684 pages pre-fetched
total images loading time: 235.3 milliseconds (32.1%)
total rebase fixups:  149,011
total rebase fixups time: 3.7 milliseconds (0.5%)
total binding fixups: 24,932
total binding symbol lookups: 797, average images searched per symbol: 2.3
total binding fixups time: 149.9 milliseconds (20.5%)
total bindings lazily fixed up: 45 of 19,109
total init time time: 342.2 milliseconds (46.8%)
total images with weak exports:  3
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notice a large and significant difference? Me neither.&lt;/p&gt;

&lt;p&gt;The other thing that I cannot explain at the moment is where the rest of the startup time goes, e.g.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;./cold.sh startup.d
Total: 10001.723521ms
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So it took less than 1 second to dynamically link Firefox but where did the other 9 seconds of startup go?&lt;/p&gt;

&lt;p&gt;cold.sh is rather simple&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash

cmd="./Minefield.app/Contents/MacOS/firefox-bin -no-remote -foreground -P 2"

sync &amp;&amp; purge &amp;&amp; dtrace -x dynvarsize=64m -x evaltime=exec -c "$cmd" -wZs $1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and the startup.d script doesn’t do much either&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#pragma D option quiet

BEGIN
{
 start = timestamp;
}

/* stop tracing here */

mozilla$target:::main-entry
{
 exit(0);
}

END
{
 this-&gt;total = timestamp - start;
 printf("Total: %u.%06ums\n", this-&gt;total / 1000000, this-&gt;total % 1000000);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;main-entry&lt;/em&gt; is my static probe, built into the Firefox source code. It fires once the main Firefox function, &lt;em&gt;XRE_main&lt;/em&gt;, is entered.&lt;/p&gt;

&lt;p&gt;I don’t have an explanation yet but 9 seconds is a very large difference but it just may be DTrace because of similar cold startup timings for Safari and Firefox.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/V_hbQ2hYRu4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/V_hbQ2hYRu4/174030241</link><guid isPermaLink="false">http://wagerlabs.com/post/174030241</guid><pubDate>Fri, 28 Aug 2009 18:43:30 +0100</pubDate><category>dyld</category><category>safari</category><category>firefox</category><category>cache</category><category>mac</category><category>performance</category><feedburner:origLink>http://wagerlabs.com/post/174030241</feedburner:origLink></item><item><title>Faster Mac Firefox</title><description>&lt;p&gt;I started at Mozilla this Monday and my focus is on making Firefox run faster which includes startup and page rendering.&lt;/p&gt;

&lt;p&gt;I thought I’d start by checking dynamic linking time of Firefox and Safari.&lt;/p&gt;

&lt;p&gt;My testbed consists of&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;3 years old 2.16Ghz CoreDuo MacBook Pro, 2Gb of 667Mhz DDR2 memory, 100Gb 7200 RPM hard drive&lt;/li&gt;
&lt;li&gt;recent 2.93Ghz Core2Duo MacBook Pro, 4Gb of 1067Mhz DDR3 memory, 256Gb Apple SSD&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Running on the latter machine, I have&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;total time: 5.8 seconds (100.0%)
total images loaded:  116 (114 from dyld shared cache, 114 needed no fixups)
total segments mapped: 5, into 30 pages with 10 pages pre-fetched
total images loading time: 2.4 seconds (42.5%)
total rebase fixups:  1,298
total rebase fixups time: 0.1 milliseconds (0.0%)
total binding fixups: 2,444
total binding symbol lookups: 236, average images searched per symbol: 1.6
total binding fixups time: 895.5 milliseconds (15.3%)
total bindings lazily fixed up: 3 of 889
total init time time: 2.4 seconds (42.1%)
total images with weak exports:  1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;for Safari, and&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;total time: 5.9 seconds (100.0%)
total images loaded:  105 (92 from dyld shared cache, 56 needed no fixups)
total segments mapped: 49, into 5894 pages with 684 pages pre-fetched
total images loading time: 4.4 seconds (74.4%)
total rebase fixups:  148,829
total rebase fixups time: 5.3 milliseconds (0.0%)
total binding fixups: 24,885
total binding symbol lookups: 794, average images searched per symbol: 2.3
total binding fixups time: 350.1 milliseconds (5.9%)
total bindings lazily fixed up: 45 of 17,764
total init time time: 1.1 seconds (19.5%)
total images with weak exports:  3
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;for Firefox.&lt;/p&gt;

&lt;p&gt;From the above I conclude that the dynamic linker is bloody fast, taking minimal time to fix up thousands of bindings (library function pointers, etc.).&lt;/p&gt;

&lt;p&gt;I can also conclude that Safari takes twice as long to run its static initializers (total init time).&lt;/p&gt;

&lt;p&gt;Dynamic linking is not the bottleneck then, so I must keep digging!&lt;/p&gt;

&lt;p&gt;Here are the results for the faster machine and Safari&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;total time: 623.0 milliseconds (100.0%)
total images loaded:  116 (114 from dyld shared cache, 114 needed no fixups)
total segments mapped: 5, into 30 pages with 10 pages pre-fetched
total images loading time: 216.7 milliseconds (34.7%)
total rebase fixups:  1,298
total rebase fixups time: 0.1 milliseconds (0.0%)
total binding fixups: 2,476
total binding symbol lookups: 234, average images searched per symbol: 1.6
total binding fixups time: 49.2 milliseconds (7.9%)
total bindings lazily fixed up: 3 of 901
total init time time: 356.9 milliseconds (57.2%)
total images with weak exports:  1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;as well as Firefox&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;total time: 792.2 milliseconds (100.0%)
total images loaded:  105 (92 from dyld shared cache, 56 needed no fixups)
total segments mapped: 49, into 5894 pages with 684 pages pre-fetched
total images loading time: 281.0 milliseconds (35.4%)
total rebase fixups:  148,829
total rebase fixups time: 2.6 milliseconds (0.3%)
total binding fixups: 24,885
total binding symbol lookups: 794, average images searched per symbol: 2.3
total binding fixups time: 66.7 milliseconds (8.4%)
total bindings lazily fixed up: 45 of 17,764
total init time time: 441.8 milliseconds (55.7%)
total images with weak exports:  3
&lt;/code&gt;&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/VsI1Mugodp8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/VsI1Mugodp8/168237170</link><guid isPermaLink="false">http://wagerlabs.com/post/168237170</guid><pubDate>Fri, 21 Aug 2009 17:12:00 +0100</pubDate><category>firefox</category><category>safari</category><category>performance</category><feedburner:origLink>http://wagerlabs.com/post/168237170</feedburner:origLink></item><item><title>The $1000 Erlang challenge</title><description>&lt;a href="http://groups.google.com/group/erlang-programming/browse_thread/thread/1931368998000836"&gt;The $1000 Erlang challenge&lt;/a&gt;: &lt;p&gt;Show me how much I suck, receive a $1000 bounty.&lt;/p&gt;
&lt;p&gt;The Ultimate Erlang Challenge is on!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/BlomG1bXWwc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/BlomG1bXWwc/142371382</link><guid isPermaLink="false">http://wagerlabs.com/post/142371382</guid><pubDate>Wed, 15 Jul 2009 23:14:00 +0100</pubDate><category>erlang</category><feedburner:origLink>http://wagerlabs.com/post/142371382</feedburner:origLink></item><item><title>Ex-Goldman Erlang programmer steals super-secret high-frequency trading code</title><description>&lt;a href="http://www.scribd.com/doc/17118166/Complaint-Aleynikov"&gt;Ex-Goldman Erlang programmer steals super-secret high-frequency trading code&lt;/a&gt;: &lt;p&gt;I interviewed with Serge Aleynikov after he left Goldman Sachs, just a short while ago. Decided to stay put rather than continue interviewing at ex-Citadel Misha Malyshev’s Chicago trading startup.&lt;/p&gt;
&lt;p&gt;I wonder, though, how exactly does a programmer go from 400K a year at Goldman (very real) to 3 times as much at a hedge fund? How do you make yourself 3 times as valuable or useful?&lt;/p&gt;
&lt;p&gt;I asked for 200k which, in retrospect, seems too little. Still, I value my quality of life in sunny Tenerife far more than long hours for high pay in cold and windy Chicago.&lt;/p&gt;
&lt;p&gt;Uploading to Rapidshare from Goldman? Copying to his home computer? Claiming that he planned to cull just the “open source bits”? Deleting BASH history? Waving your Miranda rights orally and in writing? I feel for Serge and his three young girls but I think the whole thing is stupid on many levels.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/s5WJBkPeIUE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/s5WJBkPeIUE/136975360</link><guid isPermaLink="false">http://wagerlabs.com/post/136975360</guid><pubDate>Tue, 07 Jul 2009 09:51:00 +0100</pubDate><category>trading</category><feedburner:origLink>http://wagerlabs.com/post/136975360</feedburner:origLink></item><item><title>"When one door closes, another will open, but standing in that hallway can be hell. You just have to..."</title><description>“When one door closes, another will open, but standing in that hallway can be hell. You just have to persevere. Quite often that dragon of failure is really chasing you off the wrong road and on to the right one.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;&lt;a href="http://www.scribd.com/doc/16588637/Paul-Tudor-Jones-Failure-Speech-June-2009"&gt;“Failure” speech, Paul Tudor Jones, 2009&lt;/a&gt;&lt;/em&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/tgSzIhBhcmE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/tgSzIhBhcmE/126614511</link><guid isPermaLink="false">http://wagerlabs.com/post/126614511</guid><pubDate>Fri, 19 Jun 2009 20:47:00 +0100</pubDate><feedburner:origLink>http://wagerlabs.com/post/126614511</feedburner:origLink></item><item><title>What is the point?</title><description>&lt;p&gt;What is the point of pushing %EBX just to &lt;em&gt;call&lt;/em&gt; the next instruction and pop it?&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; +4 37444c71 pushl %ebx
 +5 37444c72 subl  $0x30,%esp
 +8 37444c75 calll 0x37444c7a
+13 37444c7a popl  %ebx
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Is this some kind of an idiom?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mistery solved. The code in question is how GCC calculates the Objective-C selector (method pointer).&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/I7LDdSNWg-I" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/I7LDdSNWg-I/125816094</link><guid isPermaLink="false">http://wagerlabs.com/post/125816094</guid><pubDate>Thu, 18 Jun 2009 14:11:00 +0100</pubDate><category>performance</category><category>assembler</category><feedburner:origLink>http://wagerlabs.com/post/125816094</feedburner:origLink></item><item><title>This is where I live!</title><description>&lt;object type="application/x-shockwave-flash" width="400" height="300" data="http://vimeo.com/moogaloop.swf?clip_id=3846698&amp;server=vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF"&gt;&lt;param name="quality" value="best" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="scale" value="showAll" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3846698&amp;server=vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF" /&gt;&lt;embed src="http://www.vimeo.com/moogaloop.swf?clip_id=3846698&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;This is where I live!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/ROM3SfXhzxQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/ROM3SfXhzxQ/124137452</link><guid isPermaLink="false">http://wagerlabs.com/post/124137452</guid><pubDate>Mon, 15 Jun 2009 21:16:40 +0100</pubDate><feedburner:origLink>http://wagerlabs.com/post/124137452</feedburner:origLink></item><item><title>"Don’t worry about people stealing your ideas. If your ideas are any good, you’ll have to ram them..."</title><description>“Don’t worry about people stealing your ideas. If your ideas are any good, you’ll have to ram them down people’s throats.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Howard Aiken, IBM&lt;/em&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/krL2GWFcAr0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/krL2GWFcAr0/93786400</link><guid isPermaLink="false">http://wagerlabs.com/post/93786400</guid><pubDate>Tue, 07 Apr 2009 12:52:00 +0100</pubDate><feedburner:origLink>http://wagerlabs.com/post/93786400</feedburner:origLink></item><item><title>How to land your dream job using LinkedIn</title><description>&lt;a href="http://tinyco.de/2009/03/09/how-to-land-your-dream-job-using-linkedin.html"&gt;How to land your dream job using LinkedIn&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/NuBMKsLm5zc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/NuBMKsLm5zc/85057007</link><guid isPermaLink="false">http://wagerlabs.com/post/85057007</guid><pubDate>Tue, 10 Mar 2009 01:39:54 +0000</pubDate><feedburner:origLink>http://wagerlabs.com/post/85057007</feedburner:origLink></item><item><title>indoctrination</title><description>&lt;img src="http://8.media.tumblr.com/pAcGlPffdkv4rh600Yl6eRGko1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;indoctrination&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/kdi_Wror2Qw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/kdi_Wror2Qw/84973234</link><guid isPermaLink="false">http://wagerlabs.com/post/84973234</guid><pubDate>Mon, 09 Mar 2009 20:08:18 +0000</pubDate><feedburner:origLink>http://wagerlabs.com/post/84973234</feedburner:origLink></item><item><title>Things look scary but looks can be deceiving! That’s...</title><description>&lt;img src="http://20.media.tumblr.com/pAcGlPffdklamw95yHFR35tto1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Things look scary but looks can be deceiving! That’s Tenerife, the island where I live.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/TMCFYnWwjyc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/TMCFYnWwjyc/82944420</link><guid isPermaLink="false">http://wagerlabs.com/post/82944420</guid><pubDate>Mon, 02 Mar 2009 22:55:00 +0000</pubDate><feedburner:origLink>http://wagerlabs.com/post/82944420</feedburner:origLink></item><item><title>"low-level haskell code is usually 3 times harder to write and 3 times slower than gcc code. native..."</title><description>“low-level haskell code is usually 3 times harder to write and 3 times slower than gcc code. native haskell code is tens to thousands times slower than C code”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;&lt;a href="http://groups.google.com/group/fa.haskell/browse_thread/thread/53b3159d930c10d7#"&gt;ghc vs gcc thread at fa.haskell&lt;/a&gt;&lt;/em&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/NcxNFfLN9oM" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/NcxNFfLN9oM/82283297</link><guid isPermaLink="false">http://wagerlabs.com/post/82283297</guid><pubDate>Sat, 28 Feb 2009 15:34:17 +0000</pubDate><feedburner:origLink>http://wagerlabs.com/post/82283297</feedburner:origLink></item><item><title>OCaml+LLVM vs C++</title><description>&lt;p&gt;I’m prone to cooking with too many ingredients and &lt;a href="http://tinyco.de/2009/02/16/going-indie-today.html"&gt;my latest project&lt;/a&gt; is a great example. I want to build a Mac trading platform and it must allow &lt;a href="http://lambda-the-ultimate.org/node/2201"&gt;EasyLanguage&lt;/a&gt; for writing of trading systems. I have a parser already written in OCaml and I would like to compile EasyLanguage rather than interpret. I want vectorization and huge optimization speedups. This is where &lt;a href="http://llvm.org/"&gt;LLVM&lt;/a&gt; comes in.&lt;/p&gt;
&lt;p&gt;LLVM has excellent OCaml bindings but code generated by the LLVM just-in-time (JIT) compiler cannot call out to OCaml. I would need to generate C wrappers for OCaml code using LLVM, basically wrapping my OCaml trading platform in C code. The alternative is to write the trading platform in C or C++ but where does that leave OCaml? Is there a huge benefit to OCaml when I’m only using it to implement the parser? I don’t think so!&lt;/p&gt;
&lt;p&gt;That leaves me actively looking at using &lt;a href="http://spirit.sourceforge.net/"&gt;Boost::Spirit&lt;/a&gt; for the parser and C++ for the rest of AlgoKit. It’s often said that the right thing to do is the thing you are most afraid of. I have conquered Erlang, OCaml, Haskell and Lisp but I’m scared of C++. Would you believe it?&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/BSOfJa8gNN0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/BSOfJa8gNN0/80799863</link><guid isPermaLink="false">http://wagerlabs.com/post/80799863</guid><pubDate>Mon, 23 Feb 2009 16:49:00 +0000</pubDate><category>ocaml</category><category>c++</category><feedburner:origLink>http://wagerlabs.com/post/80799863</feedburner:origLink></item><item><title>Cooking with too many ingredients.</title><description>&lt;img src="http://22.media.tumblr.com/pAcGlPffdkaxg267etZPwXwgo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Cooking with too many ingredients.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TenerifeSkunkworks/~4/syxjSP0eZ4w" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TenerifeSkunkworks/~3/syxjSP0eZ4w/80799553</link><guid isPermaLink="false">http://wagerlabs.com/post/80799553</guid><pubDate>Mon, 23 Feb 2009 16:48:04 +0000</pubDate><feedburner:origLink>http://wagerlabs.com/post/80799553</feedburner:origLink></item><lastBuildDate>Sat, 07 Nov 2009 00:00:00 PST</lastBuildDate></channel></rss>
