How to get time elapsed in milliseconds

2020-04-03 12:44发布

Since performance of string concatenation is quite weak in VB6 I'm testing several StringBuilder implementations. To see how long they're running, I currently use the built-in

Timer

function which only gives me the number of seconds that have passed after midnight.

Is there a way (I guess by importing a system function) to get something with milliseconds precision?

8条回答
Root(大扎)
2楼-- · 2020-04-03 13:33

You might also consider using a different approach. Try calling your routines from a loop with enough iterations to give you a measurable time difference.

查看更多
叛逆
3楼-- · 2020-04-03 13:35

You can try using the System::Diagnostics::Stopwatch

Imports System.Diagnostics

Dim sw As New Stopwatch()
sw.Start()
// do something
LOG("Elapsed " + sw.ElapsedMilliseconds + " ms")
查看更多
登录 后发表回答