Tuesday, October 2, 2007

NotesRichTextItem.AppendText is FAST

Did a little benchmark today.

Code:

Dim startTime As Single, i As Integer,_
streng As String
startTime = Timer()

For i = 1 To 20000
streng = streng + "1234"
Next

Call htmlbod.write( streng )
Call htmlbod.write( |<h1>Concatenation: | +_
Cstr( Round(Timer() - startTime, 4) ) + |</h1>| )

startTime = Timer()

For i = 1 To 20000
Call htmlbod.write( "1234" )
Next

Call htmlbod.write( |<h1>AppendText: | +_
Cstr( Round(Timer() - startTime, 4) ) + |</h1>| )


Result
Concatenation: 1,7188
AppendText: ,1719

The bigger the string-pieces, the more difference. Not a real-life benchmark, but at least it indicates that AppendText is lightning fast.

0 comments: