How would do you call flyout()?

-j

On Feb 11, 12:03 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote:
> Personally, I do something like this, say for an event that is called
> frequently:
>
> function flyout(e)
> {
>         if (!this.$self) this.$self = $(this);
>         this.$self.show();
>
> }
>
> JK
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
>
> Behalf Of Michal Popielnicki
> Sent: Monday, February 11, 2008 5:41 AM
> To: jQuery (English)
> Subject: [jQuery] Re: jQuery caching DOM refferences? Performance issues
>
> Hi there, and thanks for the reply.
>
> Actually there is no visible bottleneck yet and I can't really point
> it out since the javascript behind the app is massive and it results
> in poor performance under Opera (which is very strange, since its the
> fastest browser supporting JS) .
>
> However I was wondering about ways that the performance can be
> improved ad that was generally where I suggested the solution and
> basing on Your opinion it should work.
>
> If there are any other opinions/suggestions I'd be glad to hear them.
>
> Thanks in advance
>
> Best regards!
>
> On 11 Lut, 01:55, J Moore <[EMAIL PROTECTED]> wrote:
> > You can profile javascript with firebug and see total calls for
> > different approaches and how long they take.
>
> > That said, $('#id') is fast, since it is basically getElementById() a
> > native javascript method. However, if you call $('#id') 100x, you'll
> > see that it's faster to cache it in a variable. e.g
>
> > var id = $('#id');
> > for (i=0;i<100;i++) {
> >  id.append("<p>number "+i+"</p>");
>
> > }
>
> > what is the bottleneck in your code?
>
> > -j
>
> > On Feb 10, 6:12 pm, Michal Popielnicki <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hi there!
>
> > > I've been dealing with some performance clean-up of a code of a web-
> > > app that I wrote and I was wondering if jQuery does caching of the DOM
> > > references. Lets say I have a function:
>
> > > function myFunction(){
> > > $('#foo').attr("bar");
>
> > > }
>
> > > I frequently refer to the function, so is it the case that each time I
> > > launch it, the DOM is scanned for element with "foo" id? Or maybe this
> > > reference is somehow cached?
>
> > > If its not, then maybe doing something like this would speed up the
> > > code execution:
>
> > > function DomLinker(){
> > > this.foo = $('#foo').attr("bar");
>
> > > function myFunction(){
> > > domMember.foo.attr("bar");}
>
> > > $(document).ready(
> > > domMember = new DomLinker();
>
> > > }
>
> > > Please keep in mind that we talk about case of many executions of
> > > myFunction
>
> > > Please share your thoughts on this one.
>
> > > Best regards

Reply via email to