https://bugs.documentfoundation.org/show_bug.cgi?id=147109
Bug ID: 147109
Summary: Calc SUBSTITUTE function slows down disproportionately
as text length increases.
Product: LibreOffice
Version: 7.2.5.2 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Calc
Assignee: [email protected]
Reporter: [email protected]
Run Basic script:
Sub TestSubstitute
Dim s as String, i as Long, n as Long, t as Long, msg as String
With ThisComponent.Sheets(0)
n=20000
Do While n<=80000
.getCellByPosition(0,0).setFormula "=REPT("" *""; " & n & ")"
t=GetSystemTicks()
.getCellByPosition(0,1).setFormula "=SUBSTITUTE(A1;"" "";"" "")"
Msgbox "n=" & n & " time=" & (GetSystemTicks()-t)
n=n*2
Loop
End With
End Sub
Result:
n=20000 time=106
n=40000 time=507
n=80000 time=2230
The running time of the macro increases in proportion to the square of the
length of the first argument SUBSTITUTE function.
Should increase proportionally.
--
You are receiving this mail because:
You are the assignee for the bug.