Search noticably slower in 2.0.5 compared to 1.13.2

Search noticably slower in 2.0.5 compared to 1.13.2

johanjeppssonjohanjeppsson Posts: 3Questions: 1Answers: 0

Hi!

We recently switched to the new version Datatables. I like a lot of the new options, but notice that the search for large (~100k rows) are noticeably slower compared to the old version.

When looking at a flamegraph, it looks like a lot of this time is spent in _fnFilterComplete, which in the takes ~2600ms in the new version, and ~300ms in the old version for the same search on the same data. In the new version, the majority of this time appears to be spent in Array.prototype.splice.

Is there something that can be done to improve this?


This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Hmmm - interesting question. I haven't profiled it with quite so many rows client-side before looking at the search (an oversight on my part).

    I've created this little page to test it. I think I might have a way to make it faster (nulling items out, rather than using splice, and then rebuilding, or perhaps sorting the array, since it needs to mutate it), but I'll need to experiment a bit. I'll get back to you :). I'm not sure it will be tomorrow, I'm wrapped up in some infrastructure stuff for the DataTables server just now, but I'm hopeful there is a way to improve this.

    Allan

  • johanjeppssonjohanjeppsson Posts: 3Questions: 1Answers: 0

    Sounds great, thanks!

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Looking into this is much more interesting than infrastructure work...

    I've committed a change and goodness me what a difference it makes!

    From 1.1S in _fnFilter (with this specific computer and browser, etc), to 7mS! Typing in the search box feels fast an responsive now: https://live.datatables.net/yimuyiwo/2/edit .

    Thanks for brining this up! The change will be in the next release of DataTables - I'll probably drop that next week.

    Allan

  • johanjeppssonjohanjeppsson Posts: 3Questions: 1Answers: 0

    Wow, that was fast! Thanks a lot! :)

Sign In or Register to comment.