go to https://codepen.io/aragakey/pen/LYmXqEp
Click to redraw/randomize the demo
ER: fast redraw
AR: Somewhat laggy redraw
Chrome is also slow in this case so not sure if much time should be spent in investigation here.
The profile seems to suggest a couple of places ( mozilla::detail::VectorImpl::new_ , arena_t::RallocSmallOrLarge , BoyerMooreHorspool ) which spent a lot of time in Baseline. Maybe worthwhile to probe that a bit?