1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-01 13:24:10 +01:00
Commit Graph

6 Commits

Author SHA1 Message Date
Allan Jardine
6b605936f7 Update: Significant update to how sorting is applied internally in DataTables - there is no difference to how the sort is actually done, with the single exception that the -asc and -desc are not depricated in favour of the -pre method only.
- With the introduction of the -pre method in DataTables 1.9, the -asc and -desc sorting functions became more or less redundant since they are simple comparisons (all of the complexity is now in the -pre formatting function). As such the call to the -asc / -desc method is overhead that really isn't needed, and this commit introduces a sort function that doesn't call the -asc / -desc methods, instead just doing the comparison itself. In tests, this relatively simple change leads to a performance improvement of around 15% in all browsers (it also has the side benefit of less operations, so IE8- will be able to sort larger tables before flagging up a slow script warning).

- We can't just remove the sorting method which will call -asc / -desc though since not all sorting plug-ins will have a -pre method. Therefore, for backwards compatiblity the old sort function (albeit updated for the changed variables) is retained. The backwards compatibality code adds around 300 bytes to the library, but this is an unaccounced change, so backwards compatiblity must be retained.

- The old sort method will be removed in v1.11. The -asc and -desc methods are now fully depricated.

- Altered the sorting method to flatten the aaSorting array since the introduction of aDataSort in v1.9 required an extra loop in several locations. The functionality is very useful, but the extra loop can be a bit messy and slightly hit performance, so it is now flattened to be a single array (with object information so it makes sense, rather htan array indexes!).

- Altered the order of sorting when building _aSortData since it was looking up the same variable smultiple times which really wasn't needed.

This is part of a small incremental changes plan for DataTables! There are still a huge number of things to improve in this area, but this is a nice clean up and a nice 15% sorting performance improvement to get us started :-).
2012-09-29 21:25:41 +01:00
Allan Jardine
4808f0edd7 Dev update: Remove the 'row' event. On experimenting with CellCreated I've found that I'm getting around 4'500 triggers / sec with Safari 5.1, which really isn't close to fast enough (about two orders of magnitude out from what I would like) which means that a table with 2000 rows and 9 columns would see an additional overhead of about 4 seconds on initialisation - ouch!!! As such I've removed the 'row' event here and it would seriously impact larger tables. events are still extremely useful, however, I would suggest that plug-ins should use the callback arrays rather than events since it is much faster. These arrays might be developed further into DataTables' own triggering methods in future. Something to to be aware of certainly going into 1.10. 2011-12-27 19:46:43 +00:00
Allan Jardine
f535031e41 New: Use localeCompare to do string comparison, allowing much better internationlisation support for sorting strings in DataTables 2011-12-07 11:07:02 +00:00
Allan Jardine
6c923e4953 Performance changing sorting / filtering 2011-12-06 10:38:23 +00:00
Allan Jardine
65b7c9b1e6 Performance: Re-written the sorting implementation so it doesn't use either eval() of $.inArray(). inArray was found to have a serious negative effect on IE which counts operations to give the 'script is running slow' error message - the new implemention uses a value / key reverse mapping to make the look up as fast as a single object parameter retreival. Furthermore, I've done some optimisation and feature completeness work on the non-eval version of the sorting (previously the AIR sorting method) and I've found this to be at least as good (faster in some cases) than the old eval() sort, so this is now the default and only sorting method DataTables provides - 2922 2010-11-28 14:42:38 +00:00
Allan Jardine
9fcaccb570 Initial commit - DataTables 1.7.0 2010-08-17 08:42:13 +01:00