Once layout is involved even without looping to set innerHTML it becomes a lot slower.
19 karma · joined March 25, 2013
Once layout is involved even without looping to set innerHTML it becomes a lot slower.
More generally, javascript functions accepting any number of parameters, regardless of those specified in the function declaration, is quite error prone when passing functions around.
I always use anonymous functions or 'bind' to explicitly match the parameters unless all functions involved are curried.
The other reason to avoid passing 'naked' functions around too happily is the behavior of this.
I also find most optimizations to focus on simple, explicit code. Nothing like using the less common, more dynamic features of the language to hit deoptimizations.
Immutable makes it clear that the server won't update the resource in place and will handle updates by generating a new one so the browser can happily avoid checking those resources on page refresh.
Another solution would be to use an unpredictable versioning scheme so the attacker can't anticipate the name of the resources.