Sunday, June 10, 2012

Performance of String Manipulation in Uniface

One factor that every designer battles with (or should!) is efficiency. It's OK composing an program that performs well for one designer sat screwing out about on a growth host that only he is using, but it is very different when it's a huge number of customers all reaching the same host, under genuine but hefty fill.

One particularly expensive process is sequence adjustment. Developing up a sequence can use a relatively huge slice of storage and take a unexpected quantity of brand energy. So I made the decision to execute some efficiency assessments to see how this could be enhanced.

The first analyze I did was evaluating the use of a regional varying against a non-database area. I did this analyze by getting the following sequence...

" ABCDEFGHIJKLMNOPQRSTUVWXYZ 01234567890 abcdefghijklmnopqrstuvwxyz 01234567890"

...and then using putitem/id with a reverse to add this 20,000 periods, with the following outcomes...

Non-database area = 02:42.14, 02:44.64, 02:43.44 (almost 3 minutes).
Local varying = 00:00.22, 00:00.23, 00:00.22 (less than 1 second).
Component varying = 00:00.22, 00:00.22, 00:00.22 (less than 1 second).
Global varying = 00:00.22, 00:00.22, 00:00.23 (less than 1 second.

As you can see, when adjusting a sequence you should never use a area to carry the sequence. Having said that, it doesn't seem to subject which form of varying you use. I ongoing examining the different kinds of factors with 200,000 and 2,000,000 versions, without seeing the periods vary from each other.

So now I've discovered that using a varying was by far faster than using a area, I'm going to look at the different methods of developing the sequence. I can think of only two different methods...

Concatenation (using $concat)
Indirection (eg. "%%string1%%string2%%%")

So I put these to the analyze with the following four publish...

"ABCDEFGHIJKLMNOPQRSTUVWXYZ "
"01234567890 "
"abcdefghijklmnopqrstuvwxyz "
"01234567890 "

...holding the value in a regional varying and iterating 20,000,000 periods...

Concatenation = 01:03.08, 01:03.71, 01:03.t64 (just over 1 minute)
Indirection = 01:02.01, 01:01.74, 01:01.98 (just over 1 minute)

The change is almost insignificant, as I had to go to so many versions before it could be recognized. Indirection does pip concatenation to the publish though, by a whisker.

I then made the decision to try developing a bigger sequence, by beginning with the first sequence and including the other three, then getting that sequence and including the other three again, and so on. Now I also used a regional varying but iterating only 20,000 periods...

Concatenation = 00:56.41, 00:56.02, 00:56.37 (just under 1 minute)
Indirection = 00:55.61, 00:56.96, 00:56.92 (just under 1 minute)

No comments:

Post a Comment