feat(perf): improve date sorting speed #259
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's a quick perf date sorting test before & after code change with 50k rows and 8 columns
note: the date are all in ISO format (yyyy-mm-dd), it might be even bigger differences with non-ISO format
BEFORE
1st pass
sorting ASC: 2255.841064453125 ms
sorting DESC: 676.7099609375 ms
sorting ASC: 644.962646484375 ms
sorting DESC: 671.908935546875 ms
2nd pass
sorting ASC: 1981.27978515625 ms
sorting DESC: 692.999755859375 ms
sorting ASC: 673.643798828125 ms
sorting DESC: 670.118896484375 ms
AFTER
1st pass
sorting ASC: 1059.22802734375 ms
sorting DESC: 126.10400390625 ms
sorting ASC: 336.77685546875 ms
sorting DESC: 143.007080078125 ms
2nd pass
sorting ASC: 903.991943359375 ms
sorting DESC: 143.51708984375 ms
sorting ASC: 374.537109375 ms
sorting DESC: 117.73583984375 ms