Skip to content

SetValue operates on items individually instead of a bulk operation #423

@Scottmitch

Description

@Scottmitch

Enhancement Request: Improve the performance of initialization of selectize (specifically the setValue() operation).

A use-case I have has me using many selectize controls (~50) on the same page that have different initial selected values (~10-250) but share the same options (~2500). The current initialization process uses the setValue() method which is desired, but this setValue() method inserts each item individually and does not extract operations which can be done in bulk (or at the end of the bulk operation). For example, setValue() calls addItem() for each item, and this method calls insertAtCaret() each time, and this method calls setCaret() which is very expensive. Commenting out this 1 setCaret() call can bring the runtime of initialization from 20745.976ms to 2842.559ms which is ~86% improvement. In this specific case it seems like it should be possible to delay the caret manipulation until after the data has been updated? There is likely other processing that can be delayed an updated at the end of the setValue() operation.

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