← Back to team overview

calibre-devs team mailing list archive

Re: CSS normalization

 

On Mon, Jan 26, 2009 at 8:54 AM, Marshall T. Vandegrift
<llasram@xxxxxxxxx> wrote:

> Later today or this evenindI'll put together a few 'timeit' tests for
> comparison with the current approach.

Ah, the "evenindI'll," such a lovely time of day...

Running just the any2epub CSS-extraction and font-rationalization
ended up looking kind of bothersome...  I ultimately just stuck some
time.time() arithmetic around part of calibre.ebooks.epub.from_html
and around a similar part of my own EPUB-generation pipeline (markup
fixing, CSS flattening, and font normalization, the latter two being
done as a single transform).  The results themselves where pretty
variable based on the input, and I'm not sure how to present anything
useful without having some sort of "standard corpus" we could
consistently make measurements against.  On my machine, with most of
the sources I ran against, full flattening was a few seconds slower
(10 vs 8, 10 vs 12, and in one case 8 vs 4) on most inputs. But in the
pathological case of a @style attribute on almost ever element, it was
actually quite a bit faster (15 seconds vs. 30).

That said, I think it's enough to validate that the basic approach is
fast enough.  And I think I can probably speed up Stylizer some more
if I give it some more love.

-Marshall



Follow ups

References