G
Guest
In implementing the IComparer method of a listview, I found sorts by date are incredibly slow. I used a second dummy project to find out what the issue was. Code as follows simply converts two strings to two dates, and if they are not dates, uses 1/1/1900. If str1, and str2 are both valid dates, this loop runs in milliseconds. If one is not a date, the loop funds in 8 seconds. If both are not dates, then the loop runs in 16 seconds!!
Can anyone suggest a way to speed this up? I understand that type conversion can be intensive, but this is ridiculous in my opinion..
[code snippet
On Error Resume Next
For intCounter = 1 To 100
dte1 = #1/1/1900
dte2 = #1/1/1900
dte1 = CDate(str1
dte2 = CDate(str2
[Date].Compare(dte1, dte2
Nex
[end code snippet]
Can anyone suggest a way to speed this up? I understand that type conversion can be intensive, but this is ridiculous in my opinion..
[code snippet
On Error Resume Next
For intCounter = 1 To 100
dte1 = #1/1/1900
dte2 = #1/1/1900
dte1 = CDate(str1
dte2 = CDate(str2
[Date].Compare(dte1, dte2
Nex
[end code snippet]