Friday, April 28, 2017
From The Edge.: Understanding WHILE Loop Optimization
Product.......: R:BASE X, R:BASE X Enterprise (Version 10)
Build.........: 10.0.2.20411 or higher www.rupdates.com
Keywords......: Commands, WHILE, ENDWHILE, TRACE, WHILEOPT
Have you ever run into a situation where your command file or
application does not
work correctly, perhaps where a few variables are not being
calculated correctly
within a WHILE ... ENDWHILE loop, or your applications closes
unexpectedly? But,
if you run that command file or application in the Trace Debugger it
returns no
errors, or if you SET WHILEOPT OFF, the routine works as expected.
The scenarios
are typical symptoms of a non-optimized WHILE loop.
As a control structure, WHILE loops are always considered one of the
faster ways
to process code because R:BASE read the WHILE loop code into memory
and parses it
before beginning execution. R:BASE does not need to do line-by-line
reading and
parsing of the code for each iteration of the WHILE loop. As it is reads into
memory the WHILE loop code is parsed in tokens (4-byte segments). But, R:BASE
still needed to figure out what is what (e.g., parse the expressions, find
variable names, values etc.). It is faster than reading and parsing
line-by-line,
but not as fast as it could be.
In current R:BASE releases WHILE loops have been made much faster. Some of the
commands in WHILE loops are optimized as well as parsed when the WHILE loop is
read into memory. Optimization means that information about the
command is stored
in a binary format that can be easily processed.
Optimized commands and variable names, type, and location are stored
as numbers
and expressions in binary, which allows faster identification for
execution and
uses less storage space.
Complete details and examples are described within the Understanding
WHILE Loop
Optimization technical document.
From The Edge: http://www.razzak.com/fte
Article Title: Understanding WHILE Loop Optimization
Very Best R:egards,
Razzak.
www.rbase.com
www.facebook.com/rbase
--
You received this message because you are subscribed to the Google Groups
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.