开发者

Does using eval() increase memory consumption?

I have written some Javascript (specifically a jQuery plugin) in which I replace the contents of some tags with the result of an eval to give me some kind of templating mechanism.

My question is: Will using eval() over and over cause a problem with memory?

The reason I ask is that when I look at the loaded scripts with Firebug, I see all the eval'ed code listed there, so my worry is that if the user uses this application in the browser, it might cause a pr开发者_Go百科oblem with memory.


Apart from it being a bad idea to use eval, there will almost certainly be some memory overhead in setting it up.

Also eval code won't be as optimised** as there is no chance for caching or other optimisations.

** depending on browser.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜