improved loading time of hg annotate for Paper
Martin Geisler
mg at daimi.au.dk
Mon Feb 23 13:57:30 UTC 2009
Matt Mackall <mpm at selenic.com> writes:
> On Sun, 2009-02-22 at 22:00 -0500, Sid Kalra wrote:
>> # HG changeset patch
>> # User Sid Kalra <sid at sidkalra.com>
>> # Date 1235281407 18000
>> # Node ID e04ab96dbde4d067dff3f68cc6f29799811b98db
>> # Parent 3b8f2750efcfa548849f7ac6001e9724d2c65f57
>> improved loading time of hg annotate for Paper
>
> Can we get a summary of the magic involved? What's the theory? How
> noticeable is the change? Any drawbacks?
The way I read the patch, I think it replaces the table used on the
annotate page with a bunch of <div> tags:
<table>
<tr><td>author at 42</td> <td>1 first line</td></tr>
<tr><td>author at 42</td> <td>2 second line</td></tr>
</table>
becomes
<div>
<div>author at 42</div> <div>1 first line</div>
<div>author at 42</div> <div>2 second line</div>
</div>
where the first <div> has a fixed width. This is similar to the other
pages that show file content.
I don't particularly like the CSS needed for this "trick" (does
"display: inline-block" work the same in all browsers?) and I'm also
afraid that this will break if the author name becomes too wide?
I have been thinking of replacing these file listings with the code they
use on Bitbucket:
<table>
<tr>
<td>
<pre>
author at 42
author at 42
</pre>
</td>
<td>
<pre>
1
2
</pre>
</td>
<td>
<pre>
first line
second line
</pre>
</td>
</tr>
</table>
(So 1 <table>, 1 <tr>, 3 <td>, and 3 <pre>, independent of file size.)
I have not tested it, but the advantage of this should be simpler and
faster markup -- the browser has to lay out three <pre> tags in three
table cells instead of laying out one or more <div> tags per line.
Also, the column with line numbers / author names is separated from the
source code itself. This allows people to select several lines *without*
the line numbers messing up things. Compare selecting lines in
http://bitbucket.org/mirror/mercurial-crew/src/tip/README
and
http://www.selenic.com/hg/index.cgi/file/tip/README
The tricky part of this plan is to ensure that the line heights match
exactly in the three <pre> tags. But if it works for Bitbucket, I guess
we can make it work too :-)
And we loose the stripes too, hmm... unless we wrap each line in markup
again, which I wanted to avoid.
--
Martin Geisler
VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20090223/5a0fb8ff/attachment.asc>
More information about the Mercurial-devel
mailing list