background image
C H A P T E R 1 1
Data Storage and Retrieval
About Data Storage on Newton Devices
All frames are compressed automatically when they are stored as soup entries and
all soup entries are decompressed when they are referenced. The automatic
compression and decompression of soup data reduces the amount of storage space
and run-time memory required by Newton applications.
If you add a frame that references another entry, the referenced entry is copied as a
frame into the new soup entry that is created. Similarly, if you move that entry to
another store, any data it references is moved to the new store as well.
The only way to retrieve an entry is to send the
message to the soup or
union soup in which the entry resides. This method returns a cursor, which is an
object that returns entries in response to messages it receives.
As first returned by the cursor, the entry is a frame that holds references to the
entry's data. Soup data referenced by this frame is not decompressed until it is
referenced--for example, to get or set the value of one of the entry's slots. When a
slot in the entry is referenced, the system constructs the entire entry frame in the
NewtonScript heap.
Decompressed entries are cached in RAM until they are written back to the soup.
Applications can modify these cached entry frames directly. The system supplies
functions for modifying entries, writing them back to the soup, and manipulating
them in other ways.
For information about using entries, see the section "Using Entries" beginning on
page 11-57.
Alternatives to Soup-Based Storage
Although soup-based data storage offers many advantages, you may improve
your application's performance or reduce its RAM requirements by storing data
in other formats.
There are a wide variety of trade-offs to consider when choosing a structure to
represent your application data. You are strongly advised to conduct realistic tests
with the actual data set your application uses before committing to the use of a
particular data structure. It's also recommended that you design your application in
a way that allows you to experiment with the use of various data structures at any
point in its development.
When choosing schemes for storing your application's data, you need to consider
factors such as:
the kind of data to be saved
the quantity of data to be saved
how the application accesses the data
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна