[MERGE] import both c-extension and python module with the same name for testing
bialix at ukr.net
Thu Aug 9 10:03:29 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Martin Pool пишет:
> To try and summarize the thread: there are a few choices
> 1- merge something like Alexander's patch; then any module that wants
> a doubly-implemented module can just simply import it and will get
> either the C or python version
> 2- put the try/import/except/import into things that need to import it
> 3- have a pure-python wrapper module that imports whichever
> implementation is available
> 1 has the disadvantage that we're adding more code and the change
> might not be needed
Plus advantage that bzr.exe standalone installer will have inside
only compiled extension version, and therefore will be a bit smaller.
But in the same time this fact is disadvantage because you can't selftest
in standalone form corresponding python implementation (because
it's simply absent). But this is really *nitpick*: because I don't
think that someone want and should run selftest for standalone bzr.exe.
Because too many tests will fail due the nature of standalone bzr.exe.
IMO, only blackbox tests are worth to run in standalone bzr.exe.
> 2 has the disadvantage that the code for modules that import C
> extensions is more longwinded, and it may be very slightly slower
> because of the try/except statement, and perhaps substantially slower
> because probing for more files when loading the python version.
> Although some compiled modules may be used from only one module (like
> knit parsing), others like bencode may be more broadly used.
I think it's the worst variant ever, because it leads to duplicate
the same try/except block in many places.
> 3 has the substantial disadvantage that we need to load an extra
> python module and that causes many syscalls
Probably it's really small comparing to overall slowness of bzrlib.
But make things explicit.
"Explicit is better than implicit" -- I really believe in this zen.
So, I'd like to say that my patch is nice python programming exercise,
and I like how it works.
But I could agree with variant 3, if people feel that variant 1
is too hackish for bzr.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the bazaar