Threaded View

  1. #1
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,329
    Answers
    13
    Vote Rating
    118
    LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all

      0  

    Default Answered: Optimization killers

    Answered: Optimization killers


    See this document in particular these two sections:

    3. Managing arguments, and
    5. For-in

    I see many places in the Ext JS code base where the arguments object is passed where it doesn't need to be passed.

    This article states "The arguments object must not be passed or leaked anywhere."...

    Do you think this code could be optimized?
    Code:
    Ext.define('Ext.button.Button', {
        ...
        initComponent: function() {
            ...
            me.callParent(arguments);
            me.callParent(); // <-- Use this instead?
            ...

  2. In the case of the Button initComponent method you are correct - it is wasteful to pass arguments, when the initComponent method has no arguments. We try to watch out for this internally but ocassionally one slips through the cracks, Thanks for pointing it out, we'll get it fixed.

    In v5 we are incrementally moving more toward this pattern:

    Code:
    foo: function(a, b) {
        this.callParent([a, b]);
    }
    Using an array will allow Sencha Cmd to optimize the callParent call and turn it into something that looks more like this:

    Code:
        this.superclass.foo.call(this, a, b);
    When this kind of optimization is possible it is a huge win for performance, since call takes the cake for speed http://jsperf.com/passing-arguments

Thread Participants: 1