Pergunta

I'm totally new in this area and even VB. The current performance of one of my scripts is really bad. I don't know how to profile it. Hence I just use 'Shift+F8' to 'step over' instructions one by one to see where it freezed. Then it turns out to be the following two instructions:

//This compare instruction
If mail.SentOn < eCase.firstAppearance Then
  eCase.firstAppearance = mail.SentOn
End If

//And this assignment instruction in another place
eCase.firstAppearance = mail.SentOn

LEGEND: 'mail' is an instance of 'MailItem' and 'eCase' is an instance of a public class with the following member:

Public firstAppearance As Date

IMHO, maybe I need to replace 'Date' with 'Date_POINTER' or 'Date_REF' to avoid the copy construction. I don't know if those are possible. Neither have I any idea on how to improve the performance of that compare instruction.

I also need to know what is the right way to profile it. Just in case I am looking at a totally irrelevant place.

Foi útil?

Solução

Finally, I chose to use CLng(expr) to convert 'Date' to 'Long', and save/compare with that value. It's still slow, but not that slow.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top