O$4 vs O$3 performance

Mary Whittaker mary at healthsolve.com.au
Wed Apr 29 22:04:43 EDT 2009


Hi Bastian,

Thanks for that - it is interesting to know what Omnis is doing  
internally !!  I agree with your advice on storing the line count in  
a variable (lvLineCount) before the For loop - I had always suspected  
that having the list.$linecount in the loop may be an overhead.

Mary


On 30/04/2009, at 10:24 AM, Bastiaan Olij wrote:

> Hi Mary,
>
> Using "Calculate lvRow as iBookingsList.[j]" may be useful as well or
> simply making sure that the current line in iBookingsList is the line
> you want to modify and then just sending the list as the parameter.
> Since you are using a field reference all actions will be on the  
> current
> line of that list and there is no unnecessary copying of data.
>
> The reason why passing iBookingsList.[j] is slow is because Omnis has
> the most difficult time keeping a reference to an individual row in  
> the
> list and will be copying the entire row in and out of the list on  
> every
> access. This type of access is very unnatural to Omnis as it does not
> have any internal equivalent to a reference to an individual row in  
> a list.
> Why this worked faster in OS3 I'm not sure, I do know that OS3 was
> unbelievably unstable doing this sort of thing so this may well be the
> result of fixing stability problems at the cost of performance.
>
> If the list is really large it also helps showing the OO police the  
> door.
> ----
> Begin reversible block
>   Set current list iBookingsList
>   Calculate #L as #L ;; make sure the current line is set to what  
> it was
> when we are done
> end reversible block
> For each line in list
>   ...
> End For
> ----
> Can be loads faster.
>
> Even doing:
> ----
> Calculate lvLineCount as iBookingsList.$linecount()
> For j from 1 to lvLineCount step 1
>   ...
> End For
> ----
> Can improve speed lots.
>
> What you need to realize is that $linecount is a method call and every
> time the for loop executes the method call is executed. Relatively
> speaking that has far more overhead then directly accessing a  
> variable.
> The old 'for each line in list' command is even faster because it does
> all the evaluations much more effectively. Its the price we pay for
> using an interpreted language.
>
> Keep that in mind always in loops, whenever you do things through
> notation you get a performance penalty as in the background, it is
> treated as a method call with all the accompanying overhead.  
> Accessing a
> variable directly is always faster, access often can be tokenised
> speeding things up even more.
>
> Kindest Regards,
>
> Bastiaan Olij
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com

Kind Regards

Mary Whittaker
Senior Business Analyst





Office:  61 08 8203 0500
mobile: 0417 848028
Email: mary at clintelsystems.com.au





More information about the omnisdev-en mailing list