changeset 10812:5b68000faac1

tips update
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 21 Jul 2010 09:01:06 +0200
parents e38c071bbc41
children 2c2d4a2f1047
files doc/ChangeLog doc/interpreter/tips.txi
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-21  Jaroslav Hajek  <highegg@gmail.com>
+
+	* interpreter/tips.txi: Update some tips.
+
 2010-07-19  Rik <octave@nomad.inbox5.com>
 
 	* interpreter/mk_doc_cache.m: Use regexp rather than fussing with
--- a/doc/interpreter/tips.txi
+++ b/doc/interpreter/tips.txi
@@ -109,8 +109,21 @@
 Even with a m-file library function, chances are good that it is already optimized, or will be
 optimized more in a future release.
 
+For instance, even better than
+
+@example
+a = b(2:n) - b(1:n-1);
+@end example
+
+is
+
+@example
+a = diff (b);
+@end example
+
+
 @item
-Avoid computing costly intermediate results multiple times.  Octave currently
+Avoid computing costly intermediate results multiple times. Octave currently
 does not eliminate common subexpressions.
 Also, certain internal computation results are cached for variables.
 For instance, if a matrix variable is used multiple times as an index,
@@ -238,6 +251,7 @@
 Octave includes a number of other functions that can replace common types of loops,
 including @code{bsxfun}, @code{arrayfun}, @code{structfun}, @code{accumarray}.
 These functions can take an arbitrary function as a handle.
+Be sure to get familiar with them if you want to become an Octave expert.
 
 @item
 Avoid calling @code{eval} or @code{feval} excessively, because