I remember reading quite a while ago that with()
has some serious performance impacts in JavaScript due to its possibly non-deterministic change to the scope stack. I am having difficulty finding any recent discussion of this. Is this still true?
views:
56answers:
1
+2
A:
It's not so much that with has performance impacts as it is just inadvisable. See also.
For the record, it's deterministic from the browsers perspective, but not the developer who needs to place a lot more trust than usual in the context of the variable.
altCognito
2009-05-18 14:09:46
I just meant it could be non-deterministic, such as `with(getSomeObjectBasedOnUserInput())`. I remember something about because of this statement the JIT/optimizer can't do anything ahead of time, and can't reuse optimization data because the user input might change.
Jeff Mc
2009-05-18 14:26:36