开发者

YUI Dialogs: Instantiate one and show/hide several times? Or instantiate a new one each time?

If I was using the YUI to show a dialog which I might want to appear, say, five times in the course of a page, would it be better to:

A) Instantiate one, and then show and hide it several times? or

B) Instantiate a new one each time it's to be displayed, then dispose开发者_高级运维 of it?

First option seems like it'd be faster. Second option seems like it'd require fewer resources.

Thoughts?


If it were me, I would instantiate one and show it several times.

You'll save more resources over time. The resources you're talking about to hold a dialog in memory are small when you compare the resources it takes to create new ones on demand. You're users will also notice a small performance gain (given the time to create on demand versus using one that is already available).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜