background image
C H A P T E R 3
Using Views
views). Also, if there are multiple dirty views that are in different view hierarchies,
their closest common ancestor view is redrawn, potentially causing many other
views to be redrawn needlessly.
If you want to dirty and redraw more than one view at a time, it may be faster to
send the
message to the first view, then call
, send the
message to the second view, then call
, and so on, rather
than just calling
once after all views are dirtied. The performance
is highly dependent on the number of views visible on the screen, the location of
the dirty views, and their positions in the view hierarchy, so it's best to experiment
to find the solution that gives you the best performance.
Memory Usage
Each view that you create has a certain amount of system overhead associated with
it. This overhead exists in the form of frame objects allocated in a reserved area of
system memory called the NewtonScript heap. The amount of space that a frame
occupies is entirely dependent on the complexity and content of the view to which
it corresponds. As more and more views are created, more of the NewtonScript
heap is used, and overall system performance may begin to suffer as a result.
This is not usually an issue with relatively simple applications. However, complex
applications that have dozens of views open simultaneously may cause the system
to slow down. If your application fits this description, try to combine and eliminate
views wherever possible. Try to design your application so that it has as few views
as possible open at once. This can increase system performance.
You should also be aware of some important information regarding hidden and
closed views and the use of memory. This information applies to any view that is
hidden, it has been sent the
message, or to any declared view that is closed
but where the view it is declared in is still open. In these cases, the view memory
object for the view still exists, even though the view is not visible on the screen. If
the hidden or closed view contains large data objects, these objects continue to
occupy space in the NewtonScript heap.
You can reduce memory usage in the NewtonScript heap by setting to
slots that contain large objects and that you don't need when the view is hidden or
closed. You can do this in the
and then reload these slots with data when the view is shown or opened again,
using the
methods. Again, the
performance impact of these techniques is highly application-dependent and you
should experiment to see what works best.
Note that this information applies to the base view of your application, since it is
automatically declared in the system root view. As long as it is installed in the
Newton, slots that you set in the base view of your application will continue to
exist, even after the application is closed. If you store large data objects in the base
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна