Re: Do we need the restrictions on the <base> element?

Boris Zbarsky schreef:
>> Let me quote the entirety that came before this:
>
> Thank you for doing that!

Sarcasm noted -_-;;.

>>> Sure, I guess it’s odd, but that’s what I’ve been talking about. UAs 
>>> already do it with <base> in HTML, and Firefox with xml:base in 
>>> XHTML as well.
>
> As a matter of fact, if the base URI changes when you move an image in 
> the DOM in Firefox due to a different xml:base up the new parent 
> chain, it _will_ load the new image.  That was the part I was 
> disagreeing with.

Aha, interesting. That’s a bit inconsistent then, I hope you can forgive 
me the assumption that changing the |xml:base| attribute would have the 
same effect as moving. I guess that deserves a bug in Bugzilla :). Maybe 
you can send me your tests next time so I can better understand what you 
mean.

But anyway, I did some tests with moving images around [1] 
<http://www.grauw.nl/etc/tech/baseuri-test/baseuri-test3.xhtml> [2] 
<http://www.grauw.nl/etc/tech/baseuri-test/baseuri-test3.html>, test 
results (averages over 5 runs):

XHTML, different base URI, 1 |div|:  2753 ms
XHTML, different base URI, 20 |div|s:  3199 ms
XHTML, same base URI, 1 |div|:  314 ms
XHTML, same base URI, 20 |div|s:  463 ms
HTML, same base URI but src attribute changed, 1 |div|:  2834 ms
HTML, same base URI but src attribute changed, 20 |div|s:  3222 ms
HTML, same base URI, 1 |div|:  304 ms
HTML, same base URI, 20 |div|s:  452 ms

The huge difference in time with different base URIs compared to having 
the same base URI is due to repainting time; in the HTML version I 
simulated the effect by manually changing the |src| attribute (as I 
can’t have different base URIs there) and got very similar results. The 
HTML’s a little slower than the XHTML because it has an extra line of 
code to explicitly set the |src| attribute.

When the base URI is the same so the image doesn’t change, with 1 nested 
|div| in XHTML’s move is 3.2% slower, and with 20 |div|s it is 2.4% 
slower. I tested some more (not included in these tests, but it’s a 
small change) by removing the xml:base attribute from the "XHTML, same 
base URI" tests and replacing them with a |<base>| tag in the head, and 
then the performance is the same between XHTML and HTML. Also, when I 
remove the image, the performance is also the same.

Which is interesting to see; apparantly |xml:base| /does/ lead to some 
performance degradation when moving (although how much exactly is as you 
can see a bit difficult to tell), however that is only when the 
functionality is actually used on an ancestor element. So it wouldn’t 
impact performance at all for most documents, and when it does, it 
impacts performance with the equivalent of about 20 days (according to 
Moore’s law :)) (ok now I’m /really/ spinning it ;p).

Anyway, automatically updating images or not, either way would be fine 
with me. I’d prefer not updating them, I guess (I’m not looking forward 
to implementing that in Backbase), but Firefox makes a good show of only 
impacting the performance when the functionality is actually used.


~Grauw

[1] http://www.grauw.nl/etc/tech/baseuri-test/baseuri-test3.xhtml
[2] http://www.grauw.nl/etc/tech/baseuri-test/baseuri-test3.html

-- 
Ushiko-san! Kimi wa doushite, Ushiko-san nan da!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laurens Holst, student, university of Utrecht, the Netherlands.
Website: www.grauw.nl. Backbase employee; www.backbase.com.

Received on Friday, 8 June 2007 05:44:34 UTC