From: Lars Magne Ingebrigtsen <larsi@gnus.org>
To: ding@gnus.org
Subject: Re: [PATCH] shr: render table with style
Date: Tue, 07 Dec 2010 17:34:27 +0100 [thread overview]
Message-ID: <m362v5ley4.fsf@quimbies.gnus.org> (raw)
In-Reply-To: <sa3y681li0z.fsf@cigue.easter-eggs.fr>
Julien Danjou <julien@danjou.info> writes:
> I agree, but I'm just suggesting to optimize things based on real data
> rather than throwing "it will be slower that way".
Real data is great, but it takes a lot of typing to get to it. Thank
you for doing so. :-)
> It's obvious that it will be slower if we add more code (thanks). But if
> the table code execution time (you say it's slow) and what I'm proposing
> to add are having a 90/10 execution time ratio, arguing that adding more
> stuff is bloating the execution time is not really helpful. :-D
I find that in Gnus development, you really can't keep carping
"developers, develop...", er, I mean, "speed, speed, speed" enough. One
adds one more obscure extra functionality because it's nice to have, and
then you find that everything is 50% slower than before. It's happened
a lot... and mostly with code I write myself. :-)
> I've used the following data example to test the rendering:
Nice.
> I've counted 15 color rendering points in it that should be rendered
> correctly. Based on that, I've benchmarked the execution time and the
> number of rendering point correctly done on current master version and
> with my patched version.
I'm not sure I'm seeing all the rendering points, but the obvious ones
were the table/td/td {b,f}gcolor ones, right?
> Benchmark runs with:
> (benchmark-run-compiled 100
> (shr-insert-document
> (libxml-parse-html-region
> (point-min) (point-max))))
>
> With my patch the code is 58 % slower but passes twice more tests (and
> probably more, actually, I did not bother to make the numbers show how
> lame the current code is :-P).
I just did the obvious thing and altered -tag-table and -render-td to do
colourisation like -tag-font, and, tada, with the following and your
test HTML. Before:
(let ((doc
(save-excursion
(libxml-parse-html-region
(goto-char (point-min)) (search-forward "\n\n")))))
(benchmark-run-compiled 1000 (with-temp-buffer
(shr-insert-document doc))))
=> (3.0290269999999997 19 1.0066839999999786)
After adding the -tag-table and -render-td colourisations (that should
be a word):
=> (3.0097929999999997 19 1.0296220000000034)
So that's, er, faster. Ok, `benchmark-run-compiled' may not be the most
precise benchmarking tool in the world, but...
I didn't try to do TR handling, though, so yours is more ACID-ey. Or
bordercolor, but I don't really think the latter matters much...
--
(domestic pets only, the antidote for overdose, milk.)
larsi@gnus.org * Lars Magne Ingebrigtsen
next prev parent reply other threads:[~2010-12-07 16:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-06 17:30 Julien Danjou
2010-12-06 17:39 ` Lars Magne Ingebrigtsen
2010-12-06 17:42 ` Lars Magne Ingebrigtsen
2010-12-06 18:07 ` Lars Magne Ingebrigtsen
2010-12-07 9:19 ` Julien Danjou
2010-12-07 10:50 ` Lars Magne Ingebrigtsen
2010-12-07 11:16 ` Julien Danjou
2010-12-07 11:31 ` Lars Magne Ingebrigtsen
2010-12-07 11:38 ` Julien Danjou
2010-12-07 11:48 ` Lars Magne Ingebrigtsen
2010-12-07 12:08 ` Julien Danjou
2010-12-07 12:14 ` Lars Magne Ingebrigtsen
2010-12-07 12:25 ` Julien Danjou
2010-12-07 12:32 ` Lars Magne Ingebrigtsen
2010-12-07 15:27 ` Julien Danjou
2010-12-07 16:34 ` Lars Magne Ingebrigtsen [this message]
2010-12-07 17:00 ` Julien Danjou
2010-12-16 17:27 ` Lars Magne Ingebrigtsen
2010-12-17 9:23 ` Julien Danjou
2010-12-07 9:13 ` Julien Danjou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m362v5ley4.fsf@quimbies.gnus.org \
--to=larsi@gnus.org \
--cc=ding@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).