Symbian3/SDK/Source/GUID-16A1C613-288D-471C-8551-51B61290E28F.dita
changeset 13 48780e181b38
parent 7 51a74ef9ed63
equal deleted inserted replaced
12:80ef3a206772 13:48780e181b38
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept id="GUID-16A1C613-288D-471C-8551-51B61290E28F" xml:lang="en"><title>Application
    12 <concept id="GUID-16A1C613-288D-471C-8551-51B61290E28F" xml:lang="en"><title>Application Start-Up Time Optimization</title><shortdesc>It is important that phone users do not have to wait long
    13 Start-Up Time Optimization</title><shortdesc>It is important that phone users do not have to wait long for applications
    13 for applications to start. This document summarizes the techniques
    14 to start. This document summarizes the techniques for optimizing application
    14 for optimizing application start-up time.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
    15 start-up time.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
    15 <section id="GUID-4585EAA0-4169-4C5C-A7AD-AAA7FDA529C6">       <title>Introduction</title>       <p>The techniques discussed in this document
    16 <section id="GUID-4585EAA0-4169-4C5C-A7AD-AAA7FDA529C6">       <title>Introduction</title> 
    16 are limited in scope to application programming. In other words, they
    17      <p>The techniques discussed in this document are limited in scope to
    17 do not require modification of any core OS components or servers.
    18 application programming. In other words, they do not require modification
    18 Some of the techniques are general good practice and are useful to
    19 of any core OS components or servers. Some of the techniques are general good
    19 developers at all levels. </p>     <p>The techniques can be summarized
    20 practice and are useful to developers at all levels. </p>     <p>The techniques
    20 as follows:</p><ul>
    21 can be summarized as follows:</p><ul>
    21 <li><p>Avoid causing unnecessary code to be executed as an effect
    22 <li><p>Avoid causing unnecessary code to be executed as an effect of your
    22 of your code.</p></li>
    23 code.</p></li>
    23 <li><p>Defer construction of objects, loading of dynamic libraries
    24 <li><p>Defer construction of objects, loading of dynamic libraries (for example,
    24 (for example, the application model), and starting servers until you
    25 the application model), and starting servers until you need to use them.</p></li>
    25 need to use them.</p></li>
    26 <li><p>Write efficient code!</p></li>
    26 <li><p>Write efficient code!</p></li>
    27 </ul><note>There is an inevitable trade-off between shortening the start-up
    27 </ul><note>There is an inevitable trade-off between shortening the
    28 time and introducing latency elsewhere in the application. For example, if
    28 start-up time and introducing latency elsewhere in the application.
    29 you don’t connect to a server at start-up, you will have to do it later on,
    29 For example, if you don’t connect to a server at start-up, you will
    30 when the application needs to use the server. This may be overcome by a central
    30 have to do it later on, when the application needs to use the server.
    31 component that coordinates background connections, or construction, such as
    31 This may be overcome by a central component that coordinates background
    32 the view server.</note></section>
    32 connections, or construction, such as the view server.</note></section>
    33 <section id="GUID-818EB735-F408-47D9-9759-A180766996B4"><title>Measure start-up
    33 <section id="GUID-818EB735-F408-47D9-9759-A180766996B4"><title>Measure
    34 time before you start optimizing</title><p>Do not assume you know which methods
    34 start-up time before you start optimizing</title><p>Do not assume
    35 take the most time. Pay close attention to iterative and recursive operations.
    35 you know which methods take the most time. Pay close attention to
    36 Many useful tools and techniques are available to help identify poorly performing
    36 iterative and recursive operations. Many useful tools and techniques
    37 code:</p><ul>
    37 are available to help identify poorly performing code:</p><ul>
    38 <li><p>Software analysis tools, for instance <xref href="http://www.glowcode.com.dita">GlowCode</xref> and
    38 <li><p>Software analysis tools, for instance <xref href="http://www.glowcode.com" scope="external">GlowCode</xref> and
    39 MetroWerks <xref href="http://www.metrowerks.com/MW/Develop/AMC/CodeTEST/default.htm.dita">CodeTEST</xref></p></li>
    39 MetroWerks <xref format="html" href="http://www.metrowerks.com/MW/Develop/AMC/CodeTEST/default.htm" scope="external">CodeTEST</xref></p></li>
    40 <li><p>The Symbian profiling tool, profiler.exe, which is supplied on DevKits </p></li>
    40 <li><p>The Symbian profiling tool, profiler.exe, which is supplied
       
    41 on DevKits </p></li>
    41 <li><p>The RDebug class provides some profiling functions </p></li>
    42 <li><p>The RDebug class provides some profiling functions </p></li>
    42 <li><p>The TTime class can be used to time blocks of code, but beware of context
    43 <li><p>The TTime class can be used to time blocks of code, but beware
    43 switches, otherwise you may end up timing other threads!</p></li>
    44 of context switches, otherwise you may end up timing other threads!</p></li>
    44 <li><p>Deliberately slowing down suspect blocks of code can reveal whether
    45 <li><p>Deliberately slowing down suspect blocks of code can reveal
    45 or not optimizing it would bring a significant performance improvement. </p></li>
    46 whether or not optimizing it would bring a significant performance
       
    47 improvement. </p></li>
    46 </ul></section>
    48 </ul></section>
    47 <section id="GUID-594EC7CB-3477-4D0F-B489-8C1A42ED0789"><title>Defer construction
    49 <section id="GUID-594EC7CB-3477-4D0F-B489-8C1A42ED0789"><title>Defer
    48 of the application model and other data members</title><p>Many applications
    50 construction of the application model and other data members</title><p>Many applications instantiate their components, for instance error
    49 instantiate their components, for instance error handlers, dialogs and menus,
    51 handlers, dialogs and menus, during start-up. In turn, each of these
    50 during start-up. In turn, each of these components may instantiate other components,
    52 components may instantiate other components, for instance menu resources
    51 for instance menu resources and icons. This can bring some benefits, for instance
    53 and icons. This can bring some benefits, for instance reducing application
    52 reducing application complexity, revealing memory allocation problems at start-up
    54 complexity, revealing memory allocation problems at start-up rather
    53 rather than after the application has been running for some time and improving
    55 than after the application has been running for some time and improving
    54 the runtime performance of the application. However, to minimize application
    56 the runtime performance of the application. However, to minimize application
    55 start-up time, it is recommended to avoid this behavior. Your goal should
    57 start-up time, it is recommended to avoid this behavior. Your goal
    56 be to only do what is immediately necessary during start-up. </p></section>
    58 should be to only do what is immediately necessary during start-up. </p></section>
    57 <section id="GUID-F7BE9B30-1993-4736-9E88-F0E065BE1A3C"><title>Draw the application
    59 <section id="GUID-F7BE9B30-1993-4736-9E88-F0E065BE1A3C"><title>Draw
    58 as quickly as possible</title><p>During application start-up, only construct
    60 the application as quickly as possible</title><p>During application
    59 UI components that appear in the application’s initial view. This applies
    61 start-up, only construct UI components that appear in the application’s
    60 especially to the application's implementations of <codeph>CXxxApplication::CreateDocumentL()</codeph>, <codeph>CXxxDocument::ConstructL()</codeph> and <codeph>CXxxDocument::CreateAppUiL()</codeph>, all of which are called
    62 initial view. This applies especially to the application's implementations
    61 before <codeph>CXxxAppUi::ConstructL()</codeph>. Do not read bitmaps, resources,
    63 of <codeph>CXxxApplication::CreateDocumentL()</codeph>, <codeph>CXxxDocument::ConstructL()</codeph> and <codeph>CXxxDocument::CreateAppUiL()</codeph>, all of which
    62 or any other data associated with the UI from files unless it is necessary.</p><p>In <codeph>CXxxAppUi::ConstructL()</codeph>,
    64 are called before <codeph>CXxxAppUi::ConstructL()</codeph>. Do not
    63 make sure <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-C79D0B6F-C2D7-3F22-A62B-88762092E869"><apiname>CCoeControl::ActivateL()</apiname></xref> and <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-D5458F8C-E199-37DD-B821-050B749122C6"><apiname>CCoeControl::DrawNow()</apiname></xref> are
    65 read bitmaps, resources, or any other data associated with the UI
    64 called on all controls that must be drawn when the application is launched.
    66 from files unless it is necessary.</p><p>In <codeph>CXxxAppUi::ConstructL()</codeph>, make sure <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-C79D0B6F-C2D7-3F22-A62B-88762092E869"><apiname>CCoeControl::ActivateL()</apiname></xref> and <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-D5458F8C-E199-37DD-B821-050B749122C6"><apiname>CCoeControl::DrawNow()</apiname></xref> are called on all controls that
    65 Also ensure that the client-side window server command buffer is flushed by
    67 must be drawn when the application is launched. Also ensure that the
    66 calling <codeph>Flush()</codeph> on the application's window server session.
    68 client-side window server command buffer is flushed by calling <codeph>Flush()</codeph> on the application's window server session. This
    67 This ensures that there aren't any drawing commands left in the client-side
    69 ensures that there aren't any drawing commands left in the client-side
    68 buffer, after <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-D5458F8C-E199-37DD-B821-050B749122C6"><apiname>CCoeControl::DrawNow()</apiname></xref> has completed. </p></section>
    70 buffer, after <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-D5458F8C-E199-37DD-B821-050B749122C6"><apiname>CCoeControl::DrawNow()</apiname></xref> has completed. </p></section>
    69 <section id="GUID-B320F7A3-C0E3-4A3D-8B45-AEFEDFBAAD2E"><title>Minimize the
    71 <section id="GUID-B320F7A3-C0E3-4A3D-8B45-AEFEDFBAAD2E"><title>Minimize
    70 number of bitmaps used by GUI components</title><p>Often, when a large number
    72 the number of bitmaps used by GUI components</title><p>Often, when
    71 of small images are required by an application, the overhead associated with
    73 a large number of small images are required by an application, the
    72 loading each bitmap outweighs any benefit associated with their size. Some
    74 overhead associated with loading each bitmap outweighs any benefit
    73 possible ways to avoid this are: </p><ul>
    75 associated with their size. Some possible ways to avoid this are: </p><ul>
    74 <li><p>use text instead, </p></li>
    76 <li><p>use text instead, </p></li>
    75 <li><p>for very simple graphics, draw directly using drawing primitives rather
    77 <li><p>for very simple graphics, draw directly using drawing primitives
    76 than loading a bitmap,  </p></li>
    78 rather than loading a bitmap,  </p></li>
    77 <li><p>concatenate many small bitmaps into one large bitmap file to reduce
    79 <li><p>concatenate many small bitmaps into one large bitmap file to
    78 the need to search for and load multiple files.</p></li>
    80 reduce the need to search for and load multiple files.</p></li>
    79 </ul></section>
    81 </ul></section>
    80 <section id="GUID-F00BA3FF-D9BD-44DF-A284-BAF5701179D8"><title>Reduce the
    82 <section id="GUID-F00BA3FF-D9BD-44DF-A284-BAF5701179D8"><title>Reduce
    81 number of redraws</title><p>Some GUI components redraw themselves every time
    83 the number of redraws</title><p>Some GUI components redraw themselves
    82 their data changes. This may not always be necessary. Complicated GUI components
    84 every time their data changes. This may not always be necessary. Complicated
    83 should implement their<codeph>Draw()</codeph> method to only update the area
    85 GUI components should implement their<codeph>Draw()</codeph> method
    84 of the screen that has changed. For example, there is no point in redrawing
    86 to only update the area of the screen that has changed. For example,
    85 a whole list box every time a new item is appended to it. In such cases, a
    87 there is no point in redrawing a whole list box every time a new item
    86 GUI API should allow you to switch off redrawing. Beware of GUI methods that
    88 is appended to it. In such cases, a GUI API should allow you to switch
    87 cause the object they are called upon to redraw itself.</p><p>Use <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-9FB682AC-0209-302A-83F3-7BCB1162B998"><apiname>CCoeControl::DrawDeferred()</apiname></xref> in
    89 off redrawing. Beware of GUI methods that cause the object they are
    88 preference to <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-D5458F8C-E199-37DD-B821-050B749122C6"><apiname>CCoeControl::DrawNow()</apiname></xref> if possible, because
    90 called upon to redraw itself.</p><p>Use <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-9FB682AC-0209-302A-83F3-7BCB1162B998"><apiname>CCoeControl::DrawDeferred()</apiname></xref> in preference to <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-D5458F8C-E199-37DD-B821-050B749122C6"><apiname>CCoeControl::DrawNow()</apiname></xref> if possible,
    89 excessive use of <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-D5458F8C-E199-37DD-B821-050B749122C6"><apiname>CCoeControl::DrawNow()</apiname></xref> can cause GUI flicker.
    91 because excessive use of <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-D5458F8C-E199-37DD-B821-050B749122C6"><apiname>CCoeControl::DrawNow()</apiname></xref> can cause GUI flicker. For an explanation, see the documentation
    90 For an explanation, see the documentation for <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-9FB682AC-0209-302A-83F3-7BCB1162B998"><apiname>CCoeControl::DrawDeferred()</apiname></xref>. </p></section>
    92 for <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-9FB682AC-0209-302A-83F3-7BCB1162B998"><apiname>CCoeControl::DrawDeferred()</apiname></xref>. </p></section>
    91 <section id="GUID-71443827-BF8D-4BD8-8136-5023B6D65204"><title>Use ROM-based
    93 <section id="GUID-71443827-BF8D-4BD8-8136-5023B6D65204"><title>Use
    92 bitmaps rather than filestore bitmaps</title><p>Uncompressed ROM-based bitmaps
    94 ROM-based bitmaps rather than filestore bitmaps</title><p>Uncompressed
    93 that can be used in place from ROM are approximately three times faster to
    95 ROM-based bitmaps that can be used in place from ROM are approximately
    94 use than filestore bitmaps. Using them can bring a significant reduction in
    96 three times faster to use than filestore bitmaps. Using them can bring
    95 application start-up time.</p><p>Specifying bitmap= instead of file= in the
    97 a significant reduction in application start-up time.</p><p>Specifying
    96 .OBY and .IBY files when building the ROM causes bitmaps to be uncompressed
    98 bitmap= instead of file= in the .OBY and .IBY files when building
    97 before inclusion in the ROM. Other bitmaps need to be uncompressed at runtime,
    99 the ROM causes bitmaps to be uncompressed before inclusion in the
    98 which impacts performance.   </p><p>The drawback of such bitmaps is that they
   100 ROM. Other bitmaps need to be uncompressed at runtime, which impacts
    99 are large (up to 3 times larger than file based) and cannot be compressed,
   101 performance.   </p><p>The drawback of such bitmaps is that they are
       
   102 large (up to 3 times larger than file based) and cannot be compressed,
   100 although decompressing bitmaps should probably be avoided during start-up
   103 although decompressing bitmaps should probably be avoided during start-up
   101 anyway due to the extra processing required.   </p><p>If ROM space is limited,
   104 anyway due to the extra processing required.   </p><p>If ROM space
   102 consider using such ROM-based bitmaps only if they are displayed during application
   105 is limited, consider using such ROM-based bitmaps only if they are
   103 start-up. </p></section>
   106 displayed during application start-up. </p></section>
   104 <section id="GUID-5FFD3311-DF8D-4EB1-9C76-EB9F3D306655"><title>Color depth
   107 <section id="GUID-5FFD3311-DF8D-4EB1-9C76-EB9F3D306655"><title>Color
   105 matching</title><p>When bitmaps are drawn to the screen, optimum performance
   108 depth matching</title><p>When bitmaps are drawn to the screen, optimum
   106 is achieved by ensuring that:</p><codeph>Bitmap color depth = Window color
   109 performance is achieved by ensuring that:</p><codeph>Bitmap color
   107 depth = Screen device color depth </codeph><p>If this is the case, no palette
   110 depth = Window color depth = Screen device color depth </codeph><p>If this is the case, no palette mapping between the different color
   108 mapping between the different color depths is needed. On real hardware, this
   111 depths is needed. On real hardware, this optimization has been found
   109 optimization has been found to improve drawing speed by up to ten times. However,
   112 to improve drawing speed by up to ten times. However, in order to
   110 in order to match the screen and window color depth, bitmaps may need to increase
   113 match the screen and window color depth, bitmaps may need to increase
   111 in size and so this optimization is only possible if the increase in ROM or
   114 in size and so this optimization is only possible if the increase
   112 RAM usage is acceptable. </p></section>
   115 in ROM or RAM usage is acceptable. </p></section>
   113 <section id="GUID-5E89E812-4B22-4B5C-A5E4-5FBE6619DC25"><title>Minimize access
   116 <section id="GUID-5E89E812-4B22-4B5C-A5E4-5FBE6619DC25"><title>Minimize
   114 to the file system</title><p>The file server can be a major bottleneck during
   117 access to the file system</title><p>The file server can be a major
   115 start-up when virtually all threads are searching for and loading data, libraries
   118 bottleneck during start-up when virtually all threads are searching
   116 and plug-ins. Therefore reducing file access is one of the most effective
   119 for and loading data, libraries and plug-ins. Therefore reducing file
   117 ways to improve performance. </p></section>
   120 access is one of the most effective ways to improve performance. </p></section>
   118 <section id="GUID-9218ABF0-4062-439A-A5E9-273D76D4B711"><title>Minimize the
   121 <section id="GUID-9218ABF0-4062-439A-A5E9-273D76D4B711"><title>Minimize
   119 use of resource files</title><p>Resource files are used for localization and
   122 the use of resource files</title><p>Resource files are used for localization
   120 allow modifications to be made to an application without the need to rebuild
   123 and allow modifications to be made to an application without the need
   121 it, but they are expensive to use because they require access to the file
   124 to rebuild it, but they are expensive to use because they require
   122 system. </p></section>
   125 access to the file system. </p></section>
   123 <section id="GUID-C1CCFD4F-5C63-47C4-A312-38ACB5C16676"><title>Do not specify
   126 <section id="GUID-C1CCFD4F-5C63-47C4-A312-38ACB5C16676"><title>Do
   124 a default document filename for non document-based applications</title><p>Many
   127 not specify a default document filename for non document-based applications</title><p>Many applications on a smartphone do not need to use documents,
   125 applications on a smartphone do not need to use documents, for example Telephony,
   128 for example Telephony, Contacts (this uses the contacts database),
   126 Contacts (this uses the contacts database), Browser and Messaging.   </p><p>By
   129 Browser and Messaging.   </p><p>By not specifying a default document
   127 not specifying a default document filename, hundreds of milliseconds can potentially
   130 filename, hundreds of milliseconds can potentially be saved from such
   128 be saved from such applications' start-up time.   </p><p>If an application
   131 applications' start-up time.   </p><p>If an application uses a document
   129 uses a document file, application start-up may involve the following steps: </p><ul>
   132 file, application start-up may involve the following steps: </p><ul>
   130 <li><p>reading the name of the last used document file from the application’s
   133 <li><p>reading the name of the last used document file from the application’s
   131 .ini file,</p></li>
   134 .ini file,</p></li>
   132 <li><p>opening the document file, or if one doesn't exist, creating a default
   135 <li><p>opening the document file, or if one doesn't exist, creating
   133 document file, after reading its name from the application's resource file, </p></li>
   136 a default document file, after reading its name from the application's
   134 <li><p>writing the name of the last used file to the application’s .ini file
   137 resource file, </p></li>
   135 (which is created if it doesn’t exist),  </p></li>
   138 <li><p>writing the name of the last used file to the application’s
       
   139 .ini file (which is created if it doesn’t exist),  </p></li>
   136 <li><p>writing an entry to the most recently used file list (mru.dat), </p></li>
   140 <li><p>writing an entry to the most recently used file list (mru.dat), </p></li>
   137 <li><p>additional document-related processing within <xref href="GUID-96CA3B4B-993F-36C0-9A5B-DF5CC74EE20E.dita#GUID-96CA3B4B-993F-36C0-9A5B-DF5CC74EE20E/GUID-E2A40307-6EB6-3ABC-B97A-63B77F565CCF"><apiname>CEikonEnv::ConstructAppFromCommandLineL()</apiname></xref>. </p></li>
   141 <li><p>additional document-related processing within <xref href="GUID-96CA3B4B-993F-36C0-9A5B-DF5CC74EE20E.dita#GUID-96CA3B4B-993F-36C0-9A5B-DF5CC74EE20E/GUID-E2A40307-6EB6-3ABC-B97A-63B77F565CCF"><apiname>CEikonEnv::ConstructAppFromCommandLineL()</apiname></xref>. </p></li>
   138 </ul><p>The default document's name is read from the application's resource
   142 </ul><p>The default document's name is read from the application's
   139 file by <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita#GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E/GUID-5D851D0B-6399-3BD8-ADB5-63AD48494D47"><apiname>CEikAppUi::ProcessCommandParametersL()</apiname></xref>. There are
   143 resource file by <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita#GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E/GUID-5D851D0B-6399-3BD8-ADB5-63AD48494D47"><apiname>CEikAppUi::ProcessCommandParametersL()</apiname></xref>. There are two ways of preventing the application from using a default
   140 two ways of preventing the application from using a default document file: </p><ul>
   144 document file: </p><ul>
   141 <li><p>Give the default document a NULL name in the resource file:</p><codeph>RESOURCE
   145 <li><p>Give the default document a NULL name in the resource file:</p><codeph>RESOURCE TBUF { buf=""; }</codeph></li>
   142 TBUF { buf=""; }</codeph></li>
   146 <li><p>Override <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita#GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E/GUID-5D851D0B-6399-3BD8-ADB5-63AD48494D47"><apiname>CEikAppUi::ProcessCommandParametersL()</apiname></xref> to zero the document name and return EFalse. This method is slightly
   143 <li><p>Override <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita#GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E/GUID-5D851D0B-6399-3BD8-ADB5-63AD48494D47"><apiname>CEikAppUi::ProcessCommandParametersL()</apiname></xref> to
   147 more efficient because it avoids reading the default document name
   144 zero the document name and return EFalse. This method is slightly more efficient
   148 from the resource file altogether: </p><codeblock xml:space="preserve">TBool CMyAppUi::ProcessCommandParametersL(TApaCommand /*aCommand*/, TFileName&amp; aDocumentName, const TDesC8&amp; /*aTail*/){aDocumentName.Zero();return EFalse;}</codeblock></li>
   145 because it avoids reading the default document name from the resource file
       
   146 altogether: </p><codeblock xml:space="preserve">TBool CMyAppUi::ProcessCommandParametersL(TApaCommand /*aCommand*/, TFileName&amp; aDocumentName, const TDesC8&amp; /*aTail*/){aDocumentName.Zero();return EFalse;}</codeblock></li>
       
   147 </ul></section>
   149 </ul></section>
   148 <section id="GUID-2DF939E2-C30C-4A84-90DC-92234BEB6AA0"><title>Drive scanning</title><p>This
   150 <section id="GUID-2DF939E2-C30C-4A84-90DC-92234BEB6AA0"><title>Drive
   149 can be a cause of unnecessary file server use.   </p><p>To prevent excessive
   151 scanning</title><p>This can be a cause of unnecessary file server
   150 drive access and scanning, always specify a drive letter in file paths, if
   152 use.   </p><p>To prevent excessive drive access and scanning, always
   151 known. The omission of a drive letter will cause all available drives to be
   153 specify a drive letter in file paths, if known. The omission of a
   152 searched in the standard Symbian platform order, in which Z: is always searched
   154 drive letter will cause all available drives to be searched in the
   153 last. </p></section>
   155 standard Symbian platform order, in which Z: is always searched last. </p></section>
   154 <section id="GUID-C555545B-977F-490D-A7A7-5B6D0D0AD889"><title>Only make server
   156 <section id="GUID-C555545B-977F-490D-A7A7-5B6D0D0AD889"><title>Only
   155 requests if you need to</title><p> Server requests involve context switching
   157 make server requests if you need to</title><p> Server requests involve
   156 and may cause the server to run instead of the application. In the worse case
   158 context switching and may cause the server to run instead of the application.
   157 if you make a request to a server that has not yet been started you may cause
   159 In the worse case if you make a request to a server that has not yet
   158 the server to start. This will involve creating a new thread
   160 been started you may cause the server to start. This will involve
   159 (and possibly process) and running any server initialization code.</p></section>
   161 creating a new thread (and possibly process) and running any server
   160 <section id="GUID-1E571A30-5D8A-4647-939E-EF79B033B88E"><title>Use asynchronous
   162 initialization code.</p></section>
   161 server requests instead of synchronous server requests</title><p> Synchronous
   163 <section id="GUID-1E571A30-5D8A-4647-939E-EF79B033B88E"><title>Use
   162 operations or methods (particularly for server requests) can cause general
   164 asynchronous server requests instead of synchronous server requests</title><p> Synchronous operations or methods (particularly for server requests)
   163 application slowness, and in particular, a significant reduction in responsiveness.
   165 can cause general application slowness, and in particular, a significant
   164 Synchronous requests to servers mean your thread is waiting, so that no start-up
   166 reduction in responsiveness. Synchronous requests to servers mean
   165 progress is being made.   </p><p>No 'Golden Rule' exists about when to avoid
   167 your thread is waiting, so that no start-up progress is being made.
   166 synchronous requests. However, if an asynchronous version of a method exists,
   168   </p><p>No 'Golden Rule' exists about when to avoid synchronous requests.
   167 it is a good indication that the synchronous method could potentially take
   169 However, if an asynchronous version of a method exists, it is a good
   168 some time. Whilst it may take a little extra effort to handle asynchronous
   170 indication that the synchronous method could potentially take some
       
   171 time. Whilst it may take a little extra effort to handle asynchronous
   169 versions of method calls, you should consider very carefully any decision
   172 versions of method calls, you should consider very carefully any decision
   170 to use the synchronous version. It’s often easier to change from using an
   173 to use the synchronous version. It’s often easier to change from using
   171 asynchronous version to synchronous than vice versa.   </p><p>Note that in
   174 an asynchronous version to synchronous than vice versa.   </p><p>Note
   172 some situations, you might know that the server is implementing your asynchronous
   175 that in some situations, you might know that the server is implementing
   173 request synchronously. If this is the case, and the server runs with a higher
   176 your asynchronous request synchronously. If this is the case, and
   174 priority than your application, then both versions of the API may have the
   177 the server runs with a higher priority than your application, then
   175 same performance. However, using the synchronous version in this case has
   178 both versions of the API may have the same performance. However, using
   176 the drawback that it relies upon knowledge of the server's implementation,
   179 the synchronous version in this case has the drawback that it relies
   177 which could potentially change. </p></section>
   180 upon knowledge of the server's implementation, which could potentially
   178 <section id="GUID-4C7697BD-2898-4E1E-AA88-41E9F3CE2603"><title>Do not repeatedly
   181 change. </p></section>
   179 open and close connections to the same server</title><p> Opening a connection
   182 <section id="GUID-4C7697BD-2898-4E1E-AA88-41E9F3CE2603"><title>Do
   180 to a server is an expensive operation. If an application uses a server frequently
   183 not repeatedly open and close connections to the same server</title><p> Opening a connection to a server is an expensive operation. If
   181 then it should create one connection and leave it open until the application
   184 an application uses a server frequently then it should create one
   182 is destroyed. R classes declared as temporaries (on the stack, in other words)
   185 connection and leave it open until the application is destroyed. R
   183 within a method may be a sign of this behavior. </p></section>
   186 classes declared as temporaries (on the stack, in other words) within
       
   187 a method may be a sign of this behavior. </p></section>
   184 </conbody></concept>
   188 </conbody></concept>