DataTables / DataTablesSrc

DataTables source repository
https://datatables.net
MIT License
627 stars 423 forks source link

Performance: Do not apply sort when there is only one match #277

Closed xPaw closed 5 months ago

xPaw commented 5 months ago

This shaves off ~100ms when calling rows(.., {order: 'index'}) on a table with 10k rows because each row goes through selector stuff.

EDIT: Saves over a second when not using order option (so it uses current).

Before: image

After: image

This may be showing that there's some performance issue in iterating over rows() in general as it goes through all the selector and sorting shenanings for every row.

AllanJard commented 5 months ago

Sounds good to me! Are you happy contributing this under the MIT license?

xPaw commented 5 months ago

Yes.

AllanJard commented 5 months ago

Thank you!