background image
C H A P T E R 1 1
Data Storage and Retrieval
About Data Storage on Newton Devices
11-19
The most important factor to consider with respect to the kind of data is whether
the data is static or dynamic. You must use soups to store dynamic data, but a
number of options are available for storing static data. You will probably find that
certain structures lend themselves more naturally than others to working with your
particular data set.
Especially for large data sets, space-efficiency may influence your choice of one
data structure over another. In some cases, you may need to consider trade-offs
between space requirements and speed or ease of access.
Data access issues include questions such as whether the data structure under
consideration facilitates searching or sorting the data. For example, soups provide
powerful and flexible mechanisms for searching and sorting soup entry data.
Dynamic Data
11
Data your application gathers from the user must be stored in soups. Within
individual soup entries, you are free to store data in whatever manner best suits
your application's needs.
Because each entry in a soup is a frame, the price you pay for using soup-based
storage can be measured in terms of
the time required to find slots at run time
the memory space required to expand soup entries
the memory space required to store the expanded entry frames on the
NewtonScript heap
For many uses, the benefits offered by soups outweigh these costs; however, other
approaches may be more suitable for certain data sets, especially large sets of read-
only data.
For example, a large, read-only list of provinces and postal codes is saved most
compactly as a single array, frame, or binary object residing in a slot in the
application base view's template or in the application package itself. Information
stored in this way is compressed along with your application package and is not
brought into the NewtonScript heap when it is accessed. The primary disadvantages
of this scheme are that the data set is read-only and the conveniences provided by
soup queries are not available.
Static Data
11
Read-only or static data can be stored in packages held in protected memory on the
Newton. There are a variety of reasons you might store data in a package rather
than in a soup:
Storing static data in a compressed package rather than in a soup helps to
conserve store space and NewtonScript heap space.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна