Currently (in v5.0.4/js/all.js), icon#node generation relies on HTML parsing of the result of .html; a technique which can be slow.
I tried creating SVG nodes from .abstract using createElementNS, setAttribute and appendChild. It works with 1.6x - 2x spped compared to current implementation (measured by jsPerf).
The conversion function seems to work well (roughly tested in jsFiddle).
P. S. I am creating Riot.js binding of Font Awesome 5, jkr2255/riot-fontawesome. This improvement came to my mind when I was checking the behaviors of the library.
Currently (in
v5.0.4/js/all.js
),icon#node
generation relies on HTML parsing of the result of.html
; a technique which can be slow.I tried creating SVG nodes from
.abstract
usingcreateElementNS
,setAttribute
andappendChild
. It works with 1.6x - 2x spped compared to current implementation (measured by jsPerf).The conversion function seems to work well (roughly tested in jsFiddle).
P. S. I am creating Riot.js binding of Font Awesome 5, jkr2255/riot-fontawesome. This improvement came to my mind when I was checking the behaviors of the library.