Every construction of a Publisher object calls setup_option_parser which is
rather expensive.
When processing a small number of large documents the overhead may not be
too significant, but when using Sphinx to process a large number of small
documents (e.g. for API documentation where every symbol is a separate
page), >10% of the total time is spent just in setup_option_parser.
As a hack I was able to mitigate this problem by monkey patching
Publisher.setup_option_parser to cache the option_parser based on
`type(self.parser), type(self.reader), type(self.writer)` but that assumes
that the options depend only the class (which is true in practice for my
use case).
It would be great to have a proper solution for this, though.
Please CC me in any replies as I'm not subscribed to the mailing list.
|