<p>I've been wondering, is there a performance difference between using named functions and anonymous functions in Javascript? </p>

<pre><code>for (var i = 0; i &lt; 1000; ++i) {
    myObjects[i].onMyEvent = function() {
        // do something
    };
}
</code></pre>

<p>vs</p>

<pre><code>function myEventHandler() {
    // do something
}

for (var i = 0; i &lt; 1000; ++i) {
    myObjects[i].onMyEvent = myEventHandler;
}
</code></pre>

<p>The first is tidier since it doesn't clutter up your code with rarely-used functions, but does it matter that you're re-declaring that function multiple times?</p>

As a general design principle, you should avoid implimenting the same code multiple times. Instead you should lift common code out into a function and execute that (general, well tested, easy to modify) function from multiple places.
If (unlike what you infer from your question) you are declaring the internal function once and using that code once (and have nothing else identical in your program) then an anonomous function
probably
(thats a guess folks) gets treated the same way by the compiler as a normal named function.
Its a very useful feature in specific instances, but shouldn't be used in many situations.