![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^5: Substitution unexpectedly very slow, in Strawberryby swl (Parson) |
on Aug 07, 2023 at 08:20 UTC ( #11153756=note: print w/replies, xml ) | Need Help?? |
There seems not to be a threshold value at which it kicks in. This suggests it's not COW related?. Modifying the code to take an argument to use as a power of 2 gives these results on Strawberry Perl 5.38. Code is below inside readmore tags. A doubling of the n leads to a more than doubling of the time on my machine. One would need to run it many times to be confident in the true rate of change but these numbers are close to a linear relationship when plotted with time log scaled. (For those interested in such things, the power function fitted using MS Excel is t = 8E-28**(n*21.743).) Edit: n in this case is the argument to the script, so the x-axis is n, not 2**n. Edit 2: And a polynomial function gives a better fit when using actual number of repetitions: t = 2E-11*n**2 - 5E-06*n + 0.387, with R^2 = 0.9989 (indicative-only given the sample size).
Code:
In Section
Seekers of Perl Wisdom
|
|