News for hackers. Stuff that matters.
Re:Free Pascal by mikewarot on Sunday December 13, 2020 @04:24PM (#25410426)
> However, you should not actually do that, because changing s reallocates it, so you get O(n^2) runtime

Confirmed by experiment.

Parsing 1,2,...1000 string 1000 times 0.355 seconds

Parsing 1,2,....10000 string 1000 times 42.835 seconds

A given string might have 1-10 parameters in it, so the actual execution time isn't going to be that bad. I always think in terms of those 10 Mhz 286s, and how much faster it is these days. ;-)

Obviously, if I were reading Gigabytes of text, I might optimize a bit.

There are no comments on this comment yet.