Fast character access of a string

Christian, I know that this happens only with dynamic arrays and knowing the size in advance is always better and faster. This is typical for all languages and nothing special in Xojo. However, there should be no exponential timing increase. I think, it should actually go faster with larger dynamic arrays, since when larger arrays are growing the memory should usually be allocated in larger junks as well.

That does not excuse Xojo inc from using reasonably efficient algorithms for framework functions!

There is no good excuse for exponential iterator performance that I can see…

Not putting the effort to use an efficient algorithm smells like adding a feature more for marketing rather than serious use.

IMO that does not help Xojo’s reputation in the long run!

In general IMO built in stuff should have better performance than naive implementations we could do ourselves.

That is what ā€œcitizen developersā€ like myself want from the product and what could make it be perceived as a high performance RAD product.

Having a lot of inefficient (as well as buggy) stuff built it does not help with that!

-Karen

1 Like

Karen, I agree. Even the experience with the Xojo IDE would feel a lot snappier if the basic core functions of the language were fast and efficient. I suspect that many of the standard controls would also benefit from such optimizations. In the end, it would also help Xojo to win many new customers and keep existing ones.

4 Likes

I’d like to thank @Christian_Schmitz for his blog post on optimising string access, as a result of which I’ve been able to make some very nice speed improvemnets to bits of my app already. Such as reducing the processing time for one pathological data item I was sent, from 6 minutes down to 7 seconds or so. The underlying methods are several hundred times faster.

2 Likes

Great results!
I have not read @Christian_Schmitz blog yet on this but will now

1 Like

It would be great if Xojo optimised their framework accordingly. :expressionless:

1 Like

I should add that what I have done is to use the fatsest method listed in the blog, direct access to the bytes. This is rather less convenient to use when coding, than the standard string methods, and more difficult to debug. It’s worth it where speed is a consideration.

We know what we need (usually), but unfortunately, we do not know what it is ā€œintended forā€¦ā€

Tim, in my own tests using the function IndexOfBytes() was even a little bit faster than the pointer version in Christian’s blog post. However, there shouldn’t be much of a difference, anymore.

Christian’s blog post was very helpful for me as well, though!

1 Like