1. #1
    Ext User
    Join Date
    May 2007
    Posts
    10
    Vote Rating
    0
    kris is on a distinguished road

      0  

    Default Ext.fly vs Ext.get

    Ext.fly vs Ext.get


    Hello

    I'm wondering what is the cost of creating an element on-the-fly comparing to cached call (Ext.get) - in terms of memory and performance overall.
    I've just noticed that Event.getTarget use Ext.get, and with QuickTips enabled after a few cursor moves half of all my html elements get cached, even if they have nothing to do with extjs (or qtips).

    Regards
    kris

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    Ext.fly desn't cache any elements. It reuses the same Ext.Element object for use with multiple DOM elements. Ext.get creates a new Ext.Element object for each DOM element.

    Overall the use of Ext.get vs fly won't effect performance that much, but it makes sense to use less memory when possible.

    QuickTips wouldn't be caching anything, they use the flyweight version.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  3. #3
    Ext User
    Join Date
    May 2007
    Posts
    10
    Vote Rating
    0
    kris is on a distinguished road

      0  

    Default


    Hi Jack

    I was referring to this code in Ext.EventObjectImpl

    Code:
    getTarget : function(selector, maxDepth, returnEl){
            	var t = Ext.get(this.target);
                return selector ? t.findParent(selector, maxDepth, returnEl) : (returnEl ? t : this.target);
    }
    and this call from QuickTip:

    Code:
        
    onTargetOver : function(e){
            if(this.disabled){
                return;
            }
            this.targetXY = e.getXY();
            var t = e.getTarget();
    ...
    }
    when QuickTips are enabled, the latter is invoked by mouseover event for any elem on the page. e.getTarget always use Ext.get internally whether it returns Ext.Element or not.
    Now I'm thinking that it might be more efficient to return event.target directly, when returnEl == false (just like in my quicktips case)

    Regards
    kris

  4. #4
    Ext User
    Join Date
    May 2007
    Posts
    10
    Vote Rating
    0
    kris is on a distinguished road

      0  

    Default


    To be honest my motivation to digg into this was slightly different. I'm using Selenium IDE to record tests for my gui, and I noticed that 'id' attribute pop ups from nowhere before I manage to click on the element .
    Because this tool by default use existing 'id' as a selector, it can be a bit annoying (if id is not predefined, auto-generated values are useless for tests). I can imagine that the same problem can occur with other similar tools (QTP for example).

  5. #5
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    Code:
    getTarget : function(selector, maxDepth, returnEl){
            	var t = Ext.get(this.target);
                return selector ? t.findParent(selector, maxDepth, returnEl) : (returnEl ? t : this.target);
    }
    That's a recent change that will be rolled back.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  6. #6
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    This is changed in SVN.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi