On 13 February 2015 at 20:33, Victor Stinner <victor.stinner@gmail.com> wrote:
2015-02-13 11:19 GMT+01:00 Paul Moore <p.f.moore@gmail.com>:
On 13 February 2015 at 10:07, Victor Stinner <victor.stinner@gmail.com> wrote:
=> IMO the best option is to take the C implementation. What do you think?
FWIW (as I'm not a core dev) I agree. The Windows speedup is huge, and well worth adding the code. I'm assuming that the majority of the C code is cross-platform, so we're not adding a big chunk of code needing *both* Windows and C skills to maintain (any dev with C skills could handle it).
Paul
The patch can be read here: http://bugs.python.org/file36963/scandir-2.patch
Or using Rietveld: http://bugs.python.org/review/22524/#ps13104
The C code is quite simple. It takes 800 lines because C code is more "verbose" than Python code. Manipulate strings, manage memory, take care of the reference counter, etc. just takes more lines.
This isn't code I'd expect us to have to change very often, so the maintenance risks associated with the pure C implementation seem low. Having it in a separate file rather than making the main implementation file for os even larger does seem like an attractive structural option though. Regards, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia