I will have to use what is claimed to be IBM's favorite answer (often for
good reasons):
"It depends"!

Generally speaking nothing can beat the very basic and simple computer
functions like add, subtract, load, store, etc. - so therefore the simple
answer for e.g. a binary or a floating point field is that subtracting the
field from itself is as fast as anything else.

You must however remember that a RISC machine does not have a set of packed
format instructions available, so for packed fields the rules of the game
may be different. I would assume that the fastest would be to move a
character redefinition of a packed zero contents field to the character
redefinition of the packed field you want to reset.

Using AND operation to set all bits except the last half byte of the packed
field to zero is probably equally fast.

If you want to reset several fields next to each other, then redefine all of
them as one character field (data structure), and have another data
structure containing the wanted empty values, and make one character move.

However, I have to ask: Why bother? If you use PEX *PROFILE to analyze your
program doing such things then you may not be able to detect any difference
at all as long as we are speaking about just a few fields.

If you are coding in a high level language you should use ILE's optimizing
function - the optimizer is really advanced now, IBM came a long way here -
so the optimizer would probably find a good way of doing it. You cannot list
any generated MI for and ILE program, but you can of course list the
generated assembler - but this gets a little more complex to look at.

FOR OPM you can list the MI code by compiling with GENOPT(*LIST). Looking at
the generated MI will give you a good feeling for what is faster.

In any case you might want to run a PEX (Performance Explorer) *PROFILE
analysis on one of your programs if you are concerned with performance. That
would give you an indication of which instructions are consuming your CPU
time. You will see that moving zeroes to fields is so fast that they may not
even show up in the statistics produced be PEX PROFILE.

Kaare Plesner

. . . NEVER accept bad performance from your
iSeries or AS/400 - let us solve the problem
Kaare Plesner        I     SOSY A/S
                     I     Herstedøstervej 27-29
mailto:kp@sosy.dk    I     DK-2620 Albertslund
                     I     Denmark
Home office:         I     Tel +45 4494 8105
+45 5835 3305        I     Fax +45 4494 8205

    SOSY A/S - an IBM Business Partner
      Meet us at http://www.sosy.dk/

-----Original Message-----
From: mi400-bounces@midrange.com [mailto:mi400-bounces@midrange.com]On
Behalf Of Paul_Miller@TDWH.Co.Uk
Sent: Friday, January 10, 2003 11:45 AM
To: mi400@midrange.com
Subject: [MI400] CPU/MI Timings

Newbie again...!

Does anyone know which compiled RPG code is quicker...

So for example is it better to Z-ADD 0 Field or Clear Field or Move 0 Field
or maybe use an Initialise on a data structure, etc.

I am thinking of the cpu time each line will take when compiled. or would
the MI look the same for both...

Paul Miller
TD Waterhouse Bank N.V.
* Exchange Court, Duncombe Street, Leeds, LS1 4AX
+ Paul.Miller@TDWH.Co.Uk
+ Paul@Millennium-Computers.Uk.Com


Notice for email communications.

Confidentiality:  This email and its attachments are intended for the above
named only and may be confidential.  If they have come to you in error you
must take no action based on them, nor must you copy or show them to
anyone; please reply to this email and highlight the error.

Viruses:  Although we have taken steps to ensure that this email and
attachments are free from any virus, we advise that in keeping with good
computing practice the recipient should ensure that they are actually

A subsidiary of the Toronto-Dominion Bank, TD Waterhouse Investor Services
(Europe) Ltd is a member of the London Stock Exchange and OFEX and is
regulated by the Financial Services Authority. Registered in England No.
2101863. Registered Office 14/18 Finsbury Square, London EC2A 1DB. VAT
Registered No. 397 1030 51.

This is the MI Programming on the AS400 / iSeries (MI400) mailing list
To post a message email: MI400@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo.cgi/mi400
or email: MI400-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/mi400.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.