On 3/2/2011 11:43 AM, Dave Laansma wrote:
This is some old code that I didn't write, so please don't use it for
anything profitable ...



The proposal to the group is: Due to the repeated references deep into
the PARMS tables, if this were rewritten to reference these locations as
few times as possible, IN YOUR OPINION, would there be a significant
improvement in the performance of this subroutine?



All in favor of rewrite, say AYE

All opposed, say NAY



(I'm testing some U2UG-Denver skills)



MONTHLY.USAGE:



        CM=MONTH+LY.CNT

        FOR M=1 TO 12

          IF PARMS(12)<101,CM>#'' OR PARMS(12)<133,CM>#'' OR
PARMS(12)<134,CM>#'' THEN



            CUM(M)=PARMS(12)<101,CM>+PARMS(12)<133,CM>+PARMS(12)<134,CM>

          END

          IF PARMS(7)<100,CM>#'' OR PARMS(7)<101,CM>#'' OR
PARMS(7)<102,CM>#'' THEN



            IF PARMS(7)<100,CM>#'' THEN CUMO(M)=CUMO(M)+PARMS(7)<100,CM>
ELSE

              CUMO(M)=CUMO(M)+PARMS(12)<101,CM>

            END

            IF PARMS(7)<101,CM>#'' THEN CUMO(M)=CUMO(M)+PARMS(7)<101,CM>
ELSE

              CUMO(M)=CUMO(M)+PARMS(12)<133,CM>

            END

            IF PARMS(7)<102,CM>#'' THEN CUMO(M)=CUMO(M)+PARMS(7)<102,CM>
ELSE

              CUMO(M)=CUMO(M)+PARMS(12)<134,CM>

            END

          END

          CM=CM-1; IF CM=0 THEN CM=24

        NEXT M

        RETURN



_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
I dunno. If it works and the performance is GoodEnough, I would leave it. Parms is already a dimmed array, so each element is addressed independently.

Might be fun to use the U2 vector functions on it and get rid of the loop, i.e. OCONVS() and SUM() instead of the loop.
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to