| 1 | |
|---|
| 2 | <!DOCTYPE html |
|---|
| 3 | PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|---|
| 4 | <html> |
|---|
| 5 | <head> |
|---|
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|---|
| 7 | |
|---|
| 8 | <!-- |
|---|
| 9 | This HTML is auto-generated from an M-file. |
|---|
| 10 | To make changes, update the M-file and republish this document. |
|---|
| 11 | --> |
|---|
| 12 | <title>Optimizing performance</title> |
|---|
| 13 | <meta name="generator" content="MATLAB 7.7"> |
|---|
| 14 | <meta name="date" content="2008-11-05"> |
|---|
| 15 | <meta name="m-file" content="OptimizePerformance"> |
|---|
| 16 | <link type="text/css" rel="stylesheet" href="../style.css"> |
|---|
| 17 | </head> |
|---|
| 18 | <body> |
|---|
| 19 | <p class="header">RWTH - Mindstorms NXT Toolbox</p> |
|---|
| 20 | <div class="content"> |
|---|
| 21 | <h1>Optimizing performance</h1> |
|---|
| 22 | <!--introduction--> |
|---|
| 23 | <p>When working with RWTH - Mindstorms NXT Toolbox and USB connections, high packet rates of more than 100 sensor or motor readings |
|---|
| 24 | per second are common. In order to achieve such short latency for MATLAB - NXT communication, high CPU load is generated, |
|---|
| 25 | being the speed limit on slow machines. |
|---|
| 26 | </p> |
|---|
| 27 | <!--/introduction--> |
|---|
| 28 | <p>To improve performance, a function called</p><pre class="codeinput">OptimizeToolboxPerformance |
|---|
| 29 | </pre><p>is provided. It will replace the frequently called function <tt>typecast</tt> with a faster binary version (<tt>typecastc</tt>). The binary MEX-files are already included in your MATLAB installation directory. But since they reside in a private directory, |
|---|
| 30 | they cannot be accessed from the outside. That is why <tt>OptimizeToolboxPerformance</tt> will try to copy all binary files to the toolboxes own private directory. So, before calling the function, make sure you |
|---|
| 31 | got write access where you installed RWTH - Mindstorms NXT Toolbox. |
|---|
| 32 | </p> |
|---|
| 33 | <p>The function <tt>OptimizeToolboxPerformance</tt> is fail-safe and verifies each step. The user is asked before action is taken. Just run the command to improve your toolbox |
|---|
| 34 | performance by a factor of up to 3 (depending on your machine of course). If it succeeds, the lowlevel functions <tt>wordbytes2dec</tt> and <tt>dec2wordbytes</tt> will have been replaced by faster versions, leading to less CPU load needed (and hence faster toolbox speed). |
|---|
| 35 | </p> |
|---|
| 36 | <p>Please note that the function only copies files that are already present in you MATLAB installation. So the optimization will |
|---|
| 37 | most likely only work for the specific MATLAB version, and only for the operating system you ran the command from. |
|---|
| 38 | </p> |
|---|
| 39 | <p class="footer"><br> |
|---|
| 40 | Published with MATLAB® 7.7<br></p> |
|---|
| 41 | </div> |
|---|
| 42 | <!-- |
|---|
| 43 | ##### SOURCE BEGIN ##### |
|---|
| 44 | %% Optimizing performance |
|---|
| 45 | % When working with RWTH - Mindstorms NXT Toolbox and USB connections, high |
|---|
| 46 | % packet rates of more than 100 sensor or motor readings per second are |
|---|
| 47 | % common. In order to achieve such short latency for MATLAB - NXT |
|---|
| 48 | % communication, high CPU load is generated, being the speed limit on slow |
|---|
| 49 | % machines. |
|---|
| 50 | |
|---|
| 51 | %% |
|---|
| 52 | % To improve performance, a function called |
|---|
| 53 | |
|---|
| 54 | OptimizeToolboxPerformance |
|---|
| 55 | |
|---|
| 56 | %% |
|---|
| 57 | % is provided. It will replace the frequently called function |
|---|
| 58 | % |typecast| with a faster binary version (|typecastc|). The |
|---|
| 59 | % binary MEX-files are already included in your MATLAB installation |
|---|
| 60 | % directory. But since they reside in a private directory, they cannot be |
|---|
| 61 | % accessed from the outside. That is why |OptimizeToolboxPerformance| will |
|---|
| 62 | % try to copy all binary files to the toolboxes own private directory. So, |
|---|
| 63 | % before calling the function, make sure you got write access where you |
|---|
| 64 | % installed RWTH - Mindstorms NXT Toolbox. |
|---|
| 65 | |
|---|
| 66 | %% |
|---|
| 67 | % The function |OptimizeToolboxPerformance| is fail-safe and verifies each step. |
|---|
| 68 | % The user is asked before action is taken. Just run the command to improve |
|---|
| 69 | % your toolbox performance by a factor of up to 3 (depending on your |
|---|
| 70 | % machine of course). If it succeeds, the lowlevel functions |
|---|
| 71 | % |wordbytes2dec| and |dec2wordbytes| will have been replaced by faster |
|---|
| 72 | % versions, leading to less CPU load needed (and hence faster toolbox speed). |
|---|
| 73 | % |
|---|
| 74 | |
|---|
| 75 | %% |
|---|
| 76 | % Please note that the function only copies files that are already present |
|---|
| 77 | % in you MATLAB installation. So the optimization will most likely only |
|---|
| 78 | % work for the specific MATLAB version, and only for the operating system |
|---|
| 79 | % you ran the command from. |
|---|
| 80 | |
|---|
| 81 | ##### SOURCE END ##### |
|---|
| 82 | --> |
|---|
| 83 | </body> |
|---|
| 84 | </html> |
|---|