View Issue Details

IDProjectCategoryView StatusLast Update
0031641RunnerFunctionsPublic2020-03-09 15:31
ReporterYellowAfterlifeAssigned ToRussell Kay 
PriorityLowSeverityC - GeneralReproducibility100%
Status ClosedResolutionFixed 
PlatformWindowsOSWindows 10 ProOS Version>=18362
Product Version 
Target VersionFixed in VersionInternal Build 
Summary0031641: Functions: string_replace_all gets exponentially slower as input size increases
DescriptionGML:
for (var mag = 1; mag <= 5; mag += 0.5) {
    var num = floor(power(10, mag));
    var input = string_repeat("@123456789", num);
    var t = get_timer();
    string_replace_all(input, "@", "!");
    t = get_timer() - t;
    show_debug_message("x" + string(num) + " -> " + string(t / 1000) + "ms");
}

Output:
x10 -> 0.02ms
x31 -> 0.07ms
x100 -> 0.59ms
x316 -> 5.00ms
x1000 -> 45.99ms
x3162 -> 445.92ms
x10000 -> 4443.66ms
x31622 -> 44367.46ms
x100000 -> 499134.51ms

(a 10x increase in size leads to 100x increase in processing time)
Steps To ReproduceRun the sample on a non-HTML5 platform.
Perhaps don't wait for the final magnitude to complete, considering that it takes 450-500s on my system
Additional InformationI strongly suspect that the function simply doesn't utilize YYStrBuilder (or equivalent) and thus suffers for it.
HTML5 works really well in comparison, taking 9ms for x100000 - was I the one to rewrite that implementation following a bug report?
Tagsfunctions
1.4 Found In
2.x Runtime Found In9.9.1.1685
2.x Runtime Verified In9.9.1.1717

Activities

YellowAfterlife

2020-03-01 15:07

Developer  

a_bug.yyz (8,797 bytes)

Russell Kay

2020-03-02 15:03

Manager   ~0065410

Fixed in gitlab

now takes

x10 -> 0.01ms --> 1
x31 -> 0.03ms --> 1
x100 -> 0.04ms --> 1
x316 -> 0.09ms --> 1
x1000 -> 0.24ms --> 1
x3162 -> 0.70ms --> 1
x10000 -> 2.52ms --> 1
x31622 -> 4.81ms --> 1
x100000 -> 15.25ms --> 1

Alice

2020-03-09 15:31

Adminstrator   ~0065477

Verified fixed on IDE v9.2.1.2152 Runtime v9.9.1.1717.
The new results are:
x10 -> 0.01ms
x31 -> 0.01ms
x100 -> 0.02ms
x316 -> 0.09ms
x1000 -> 0.15ms
x3162 -> 0.36ms
x10000 -> 1.07ms
x31622 -> 4.68ms
x100000 -> 13.61ms

Closing the bug. Thank you.