Skip to content

setValue([]) Performance Degradation #306

@jeff-mccoy

Description

@jeff-mccoy

Whenever I call setValue with an array of values, Selectize takes 200-300 ms per value on the latest version of Chrome on an i7 Mac. After doing a little digging, it seems that 90% of the execution time is the call to refreshOptions().

Is there any negative side effect in skipping this call until the last element of the array? It seems to have worked for me and cut a 10 second call down to 300 ms. Thanks!

Line 662:

for (var i = 0, n = items.length; i < n; i++) {
    this.isPending = (i < n - 1);
    this.addItem(items[i]);
}

Line 1263:

if (!self.isPending) {
    self.refreshOptions(self.isFocused && inputMode !== 'single');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions