Path: news.mathworks.com!not-for-mail
From: "Matthew Simoneau" <matthew@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: MATLAB Programming Contest: November 29-Decemb
Date: Wed, 29 Nov 2006 13:31:11 -0500
Organization: The MathWorks, Inc.
Lines: 27
Message-ID: <ekkjlf$djh$1@fred.mathworks.com>
References: <ef472c3.-1@webcrossing.raydaftYaTP> <ef472c3.0@webcrossing.raydaftYaTP> <ef472c3.1@webcrossing.raydaftYaTP> <ef472c3.2@webcrossing.raydaftYaTP>
Reply-To: "Matthew Simoneau" <matthew@mathworks.com>
NNTP-Posting-Host: simoneaum.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1164825071 13937 144.212.107.69 (29 Nov 2006 18:31:11 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 29 Nov 2006 18:31:11 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
Xref: news.mathworks.com comp.soft-sys.matlab:381102



snake and Alan, I did some investigating after the last contest to see if I 
could explain the strange timing behavior that obfuscation was producing.  I 
have to say the inner workings of the interpreter is not my area, but I 
think I know what was going on.



The main effect came from jamming all the code together onto long lines. 
Last contest, when we upgraded our testing computer, we moved to 64-bit 
Linux.  The problem was that in the then-current version of MATLAB, the JIT 
wasn't as effective on 64-bit as it was in our 32-bit platforms.  (JIT is 
shorthand for our just-in-time compiler technology that generates 
machine-code instructions on the fly.)  The code would run faster on most 
contestants' machines when each line of code was on its own line because the 
JIT prefers it this way.  On the contest machine however, where the JIT was 
less effective, mashing the lines of code together reduced the overall 
runtime because the interpreter has an overhead associated with each line of 
code executed, and reducing the number of lines of code had a significant 
impact.



In the latest release of MATLAB, which we're using for this contest, the 
64-bit JIT is now on par with the 32-bit JIT.  This should negate the 
performance benefit that obfuscation was providing.