scottjehl/Respond

Blowing away style blocks an recreating is expensive

Opened this issue · 0 comments

I have a site in which applyMedia gets called about 20 times at startup.

applyMedia() will blow away any created style blocks and then re-create them even if nothing has changed. This is expensive (the 20 calls are taking about 3 seconds for me) for something that only needs to actually happen once.

I am working through the process of only removing and creating style nodes when the content has changed. Is that a useful optimization? Or am I missing something important that will cause it to fail terribly later?