1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]>
2<html xml:lang="en-US" lang="en-US">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../css/document.css" type="text/css" />
7    <title>Graphix Library (gfx) Sample Demos</title>
8  </head>
9  <body>
10    <h1>FastCreateDemo</h1>
11      <div class="section"><img src="images/FastCreateDemo.png" border="0" width="400" height="240" /></div>
12      <h2>Overview</h2>
13      <p>
14        This demo uses a frame heap allocator to create and destroy objects at high-speed.
15      </p>
16      <h2>How to Use</h2>
17      <p>
18        <ul>
19          <li>Demo-specific operations</li>
20          <ul>
21            <li>None.</li>
22          </ul>
23          <li>Common Operations</li>
24          <ul>
25            <li>Slide pad: Rotate the camera</li>
26            <li>Slide pad + A Button: Move the camera back and forth</li>
27            <li>Slide pad + B Button: Move the camera in parallel</li>
28            <li>Slide pad + Y Button: Move the camera up and down</li>
29            <li>X Button: Reset the camera position</li>
30            <li>START Button: Restart the demo.</li>
31          </ul>
32        </ul>
33      </p>
34      <h2>Description</h2>
35      <p>
36        Other gfx demos use an allocator with an expanded heap as the demo allocator.
37      </p>
38      <p>
39        By using an optimized allocator such as a frame heap allocator rather than an expanded heap allocator, objects can be created more quickly.  The FastCreateDemo can create and destroy objects at high-speed by using <a href="../../../nw/demo/FrameHeapAllocator/Overview.html">demo::FrameHeapAllocator</a> (a frame heap allocator possessing a frame heap provided by CTR-SDK) for creating grid models.
40      </p>
41      <p>
42        A frame heap is characterized by the fact that memory can be allocated at higher speed than other heaps, but is limited by the fact that only part of memory already allocated cannot be freed.  With FastCreateDemo, the amount of memory required to create models pre-calculated by the <a href="../../../nw/gfx/SceneBuilder/GetMemorySize.html">GetMemorySize</a> function is allocated from the parent allocator and that memory is then managed by FrameHeapAllocator used to create the model.
43      </p>
44      <p>
45        Because memory is only freed when using the <a href="../../../nw/gfx/GfxObject/Destroy.html">Destroy</a> function to destroy an instance of a class such as <a href="../../../nw/gfx/Model/Overview.html">Model</a> (nearly all classes that inherit <a href="../../../nw/gfx/GfxObject/Overview.html">GfxObject</a>, but not classes in the <a href="../../../nw/demo/Overview.html">demo namespace</a>), there is no need to call the Destroy function if memory is managed properly.
46      </p>
47      <p>
48        With FastCreateDemo, a one frame heap allocator is used to create the grid model, and all grid model destroys can be omitted by returning the memory managed by this allocator to the parent allocator.
49      </p>
50      <p>
51        With FastCreateDemo, this model is destroyed and created every frame.  The following table shows how much time is required to create and destroy each instance depending on the heap type.  (Note that execution times vary depending on the environment.)
52      </p>
53      <table style="width: auto;">
54        <thead>
55          <tr>
56            <th>Heap Type</th>
57            <th>Generation</th>
58            <th>Destruction</th>
59            <th>Total</th>
60          </tr>
61        </thead>
62        <tbody>
63          <tr>
64            <th>Extended Heap</th>
65            <td>7.00 ms</td>
66            <td>2.62 ms</td>
67            <td>9.62 ms</td>
68          </tr>
69          <tr>
70            <th>Frame Heap</th>
71            <td>5.84 ms</td>
72            <td>0.03 ms</td>
73            <td>5.87 ms</td>
74          </tr>
75        </tbody>
76      </table>
77      <p>
78        Deleting the define shown below located at the top of FastCreateDemo.cpp ceases use of the frame heap.
79      </p>
80      <p class="info"> #define USE_FRAME_HEAP </p>
81  <hr><p>CONFIDENTIAL</p></body>
82</html>
83