(
('
c
c
Storage Considerations
The following list shows
how
many bytes
of
storage are required for each
data
type
that
can be
in
the
active workspace:
Data
Type
Character
constant
or
variable name
Whole numbers
that
are equal
to
or
less
than
2
31
_1
Whole numbers
that
are greater
than
2
31
_1
Decimal numbers
Logical data
Number
of
Bytes Required
1 byte per
character
4 bytes
8 bytes
8 bytes
1/8
byte
(1
byte
can
contain
8
ones
or
zeros)
Because
the
5100
active workspace
contains
a fixed
amount
of
storage, it
is
good
practice
to
conserve
as
much storage as possible. Following are some considera-
tions
that
can be used
to
conserve storage:
• Make all objects (variables and user-defined functions)
not
required for use
out-
side of a user-defined
function
local
to
the
function.
• Store data
in
data files
on
the
tape,
and use an APL shared variable (see
Chapter 8)
to
transfer
the
data
into
the
active workspace when required.
• Clear suspended functions (see Chapter 7) from
the
active workspace.
•
Group
user-defined functions by related operations
and
store
each
group
into
a workspace file on tape. Then when a certain
group
of
related
functions
is
required
to
process data
in
the
active, workspace,
the
stored workspace contain-
ing these functions can be copied
into
the
active workspace. When
the
pro-
cessing
is
done,
the
functions can be
expung~d
(see Chapter 5) and
another
group
of
functions (one workspace) can be copied
into
the
active workspace.
• If a value consists
of
all
1's and D's, store
the
value as logical data.
For
example,
you
have
the
following vector: .
VECTOR~"l
0 p (2·-:1.)
VECTOR
1
111
111
1 1 1
The
result
is
a vector
of
ten
l's,
and
each 1 requires
four
bytes
of
storage.
However,
the
vector can be changed
to
a logical vector as follows:
VECT[)R~"lAVECTDr~
VECT()I~
1 1 1 1
111
111
The result looks just like
the
previous result; however, only 2
bytes
of
storage
was required.
173