You mean the nested versions? Just because it's not the most efficient way possible to do something does not automatically mean it's a 'performance issue'. If you're doing it once, or if it's some user based event like a button click, the difference will not be noticeable. If this is happening in a loop, perhaps then you might be in need of re-factoring. But in this example it would probably hardly help since it's reading and writing files, and chances are that's going to slow you down more.
EDIT: took out function hoisting stuff, it doesn't get hoisted after a quick check.
It's certainly no worse than the first example with the anonymous functions inline. But yes, worse than the second example, since it's creating closures on each invocation.
The closures aren't meant to be more performant, they simply allow you to separate your code. It's not fair to compare the unnamed function example with the closure example, since the first doesn't create closures. If it did - which would be necessary to create both functions - the examples would be equally performant.
The first and third examples are both creating closures. It doesn't matter if they're named or not. Any time you see the "function" keyword within another function, that's a closure.
Check out the performance of these three styles. #1 and #3 are almost identical, #2 is significantly faster: http://jsperf.com/closures-perf
You make a good point and thanks for the performance link. I should have been more clear. The first and third examples are only comprable in the way they create closures - which is equivalent, but they are meant to demonstrate different things. The first demonstrates nested callbacks while the last example demonstrates named functions that are organized by closures.
But this is happening anyways with unnamed functions - they will be defined any time the top level function is called. The difference is really just whether or not you are naming your functions.
EDIT: took out function hoisting stuff, it doesn't get hoisted after a quick check.