W3C home > Mailing lists > Public > www-svg@w3.org > February 2011

Re: Rendering of deeply-nested shapes with <use>

From: Jeremie Patonnier <jeremie.patonnier@gmail.com>
Date: Wed, 16 Feb 2011 15:21:02 +0100
Message-ID: <AANLkTinzULVg0xEUxSDLUkxZm+zF9zuyGvow23y2kTjA@mail.gmail.com>
To: www-svg@w3.org
Cc: johannes.roessel@uni-rostock.de, "Dr. Olaf Hoffmann" <Dr.O.Hoffmann@gmx.de>, zimmermann@physik.rwth-aachen.de

This is an interesting problem so I've make a quick scripted test to see
what's happen when there are deep nested "use" elements (see the
This use case is a bit different than the Sierpinski carpet's issue but have
similar concern.

This test is a simple loop that produce the following SVG output on each
loop :

    <use xlink:href="#priviousGElement"/>
    <text>loop number</text>

each G element include the previous G element through the USE element

To increase the deep of the test, you just have to change the value of the
JS variable "deep" (for convenient reason, there is also a lineLength
variable to perform some visual line break on the test)

After some quick test, it appear that :

   - Firefox 4 (minefield) hang significantly after a deep value of 100 but
   is able to render all the elements even with more than 300 nested USE
   elements (but it is completely freezed for a loooong time)
   - Chrome 9 do not hang but refuse to render more than 146 nested USE
   - Opera 11 hang significantly after a deep value of 200 but is able to
   render an amazing number of nested USE elements (I've try up to 600) with
   acceptable freezing time.

This is definitely not a real world scenario but there is place for
optimization here

Hope that help.
Web : http://jeremie.patonnier.net
Twitter : @JeremiePat <http://twitter.com/JeremiePat>

(image/svg+xml attachment: nested-use.svg)

Received on Wednesday, 16 February 2011 14:21:35 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:24 UTC