Apple Newton Internet Enabler Spezifikationen Seite 21

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 24
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 20
Newton Technology Journal June 1996
21
As with picture caching, using a bit map cache does not slow down the
application much as it opens. This implementation opens in 1.5 seconds,
about as fast as all of the implementations so far except the one using
setOrigin
. Our real target was to speed up scrolling. Caching bit maps
yields the fastest performance of all the implementations: 8.5 seconds to
scroll down by 10 and back up by 10 items. This is faster than even the
setOrigin
implementation and more than four times faster than the
update method implementation. By uncaching bit maps for items scrolled
off screen, heap requirements are limited to 12K, which is half that of the
setOrigin
implementation but about 50% more than the simple proto
implementation that caches pictures. Each bit map takes about 0.6K.
The improvement in speed and the loss of heap echo the difference
between commands to draw a picture and an image of that picture. The
commands take less space to store but must be executed each time the picture
is drawn (for example, cached shapes). An image of the picture takes more
space to store but can be quickly displayed (for example, cached bit maps).
USING NO PROTOS AND A
viewDrawScript
For logical completeness, consider an approach that doesn’t use any children
views. A view P could respond to
viewScrollUpScript
and
viewScrollDownScript
messages by changing a stored index and
sending itself the “dirty” message. P’s
viewDrawScript
could image all
visible items without any children views.
This approach opens in 1.0 seconds (the fastest by a small margin). It
uses very little heap (less than 1/2 K). But because it doesn’t cache any of its
shapes or
drawShape
results, it’s scrolling performance is about half as
fast as others. Adding caching would be relatively simple because the
drawShape
method will image nested arrays of shapes and style frames.
Shapes for the item just scrolled on screen could be cached in the
appropriate location, and shapes for the item just scrolled off could be
uncached. The entire cache could be passed to
drawShape
. Taking this
idea a step further, an implementation could send
drawShape
with the
cached PICTs discussed previously. Or, an implementation could send
drawShape
with the cached bit maps also discussed previously. These
variations should show the same scrolling speed improvement relative to
their non-caching variants as those discussed previously. The heap
advantage of eliminating children views would be negligible compared to the
size of the cache.
The only major drawback to approaches using no children views arises if
we want to allow the user to tap on single items to indicate some action. In
this case, the view P would have to use the
hitShape
method to determine
which item the user tapped, and P would have to implement the correct
visual and auditory feedback for the tap, that is, highlighting and clicking.
The added complexity of implementing this functionality from scratch rather
than using Newton’s view system may not be worth the incremental
improvement in scrolling speed and heap space.
SUMMARY
Table 2 summarizes the main results. Using aggregate protos either slow
the application when it opens or when it scrolls. They can impose a very
high or very low heap penalty. Using simple protos with a
viewDrawScript
can be fast both when the application opens and when
it scrolls, but a cache must be used. The cache must be carefully maintained
in order to avoid consuming too much heap.
Table 2: Speed, heap, and application size for alternative
scrolling implementations.
Time (seconds)
I
Size (K)
I
Lines
Open/Close Scroll
I
Heap Package
I
Source Code
Aggregate Proto &
setOrigin
3.6 9.8 32 10 157
Aggregate Proto &
syncChildren
1.1 32.4 5 10 202
Aggregate Proto & update method 1.6 36.5 4 11 206
Simple Proto &
viewDrawScript
1.3 21.9 1 10 152
Simple Proto & Cache PICTs 1.8 14.7 12 11 169
Simple Proto & Uncache PICTs 1.8 15.2 8 11 173
Simple Proto & Cache Bitmaps 1.5 8.5 18 11 194
Simple Proto & Uncache bitmaps 1.5 8.9 12 11 197
No Proto 1.0 17.0 0.4 11 155
This analysis might imply that a proto constructed with a number of child
views would never be appropriate for a scrolling application. To help balance
this impression, consider two rules of thumb for deciding between an
aggregate approach and one using a
viewDrawScript
:
An application should use an aggregate proto when datum components
are to display differently and react differently to user input.
An application should use a
viewDrawScript
when datum
separate utility applications.
In addition to Newton Toolkit for Windows, Apple will also soon be
providing Newton C++ Tools for Mac OS, which will allow Newton
developers to link certain compiled C++ routines directly into Newton
applications without porting into NewtonScript. All of these products
demonstrate Apple’s commitment to delivering a comprehensive set of tools
to meet the needs of Newton software developers.
Newton Toolkit for Windows is shipped on CD-ROM, and includes
complete sample code and on-line documentation. A beta version is
available right now on the WWW at http://www.dev.info.apple.com/newton,
and the final version will ship through the Apple Developer Catalog
(formerly APDA) and selected retail locations this summer.
continued from page 1
Newton Toolkit Does Windows
NTJ
NTJ
Seitenansicht 20
1 2 ... 16 17 18 19 20 21 22 23 24

Kommentare zu diesen Handbüchern

Keine Kommentare