Does reusing symbols improve SVG performance?

前端 未结 3 932
挽巷
挽巷 2020-12-05 18:11

Assuming a relatively modern, SVG-supporting desktop browser and an SVG consisting of hundreds of similar, simple nodes:

  1. The document could be set up as many i
3条回答
  •  眼角桃花
    2020-12-05 19:14

    Rohit Kalkur compared rendering speed of the creation of 5000 SVG symbols using use against directly creating the SVG symbol's shapes, see here. It turns out that rendering SVG shapes using use was almost 50% slower. He reasons that:

    The use element takes nodes from within the SVG document, and duplicates them in a non-exposed DOM

    Given this, I assume that using SVG symbols is at best as performant as manually creating the symbolss shape.

提交回复
热议问题