[PATCH] Speeding up samba-tool execution

Garming Sam garming at catalyst.net.nz
Fri Jul 15 02:48:56 UTC 2016


For a while now, the docs.py has been one of the longest running tests
in autobuild. After a lot of aimless poking, I've finally found one the
major reasons that this is the case.

Samba-tool as a whole, takes a very long time to start up. This isn't
entirely the fault of python however, nor is it because of the top level
samba module import. What I've found is that pre-load of each samba-tool
subcommand (e.g. testparm, dbcheck, user etc.) and the imports included
in the subcommands massively slow down the overall tool. Besides the
subcommand you're actually trying to run, there's no reason to load any
of the other subcommands so I've written a patch to load the subcommand
on the fly. This seems to suggest a 10x performance improvement with
some basic testing (and for testparm specifically, it's now within
striking distance of the original C code).

This change should make every call to samba-tool noticeably faster and
more responsive, which is excellent.

Feel free to review and push (otherwise it will probably get rolled into
the next time I do an autobuild).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-samba-tool-Speed-up-all-samba-tool-commands.patch
Type: text/x-diff
Size: 4190 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160715/8d66dbdf/0001-samba-tool-Speed-up-all-samba-tool-commands.diff>

More information about the samba-technical mailing list