changeset 20191:64f817945783

Use strrep instead of regexprep where possible in m-files for performance. * scripts/gui/private/__fltk_file_filter__.m, scripts/io/strread.m, scripts/plot/util/private/__go_draw_axes__.m, scripts/testfun/private/html_compare_plot_demos.m: Replace instances of regexprep with strrep.
author Rik <rik@octave.org>
date Thu, 14 May 2015 08:55:05 -0700
parents 38487298513b
children 88efded31037
files scripts/gui/private/__fltk_file_filter__.m scripts/io/strread.m scripts/plot/util/private/__go_draw_axes__.m scripts/testfun/private/html_compare_plot_demos.m
diffstat 4 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/gui/private/__fltk_file_filter__.m	Wed May 06 18:06:19 2015 +0100
+++ b/scripts/gui/private/__fltk_file_filter__.m	Thu May 14 08:55:05 2015 -0700
@@ -37,7 +37,7 @@
     curr_ext = ostrsplit (curr_ext, ";");
 
     if (length (curr_ext) > 1)
-      curr_ext = regexprep (curr_ext, '\*\.', ',');
+      curr_ext = strrep (curr_ext, '*.', ',');
       curr_ext = strcat (curr_ext{:})(2 : end);
       curr_ext = strcat ("*.{", curr_ext, "}");
     else
@@ -48,8 +48,8 @@
 
     if (c == 2)
       curr_desc = file_filter{idx, 2};
-      curr_desc = regexprep (curr_desc, '\(', '<');
-      curr_desc = regexprep (curr_desc, '\)', '>');
+      curr_desc = strrep (curr_desc, '(', '<');
+      curr_desc = strrep (curr_desc, ')', '>');
     endif
 
     if (length (fltk_str) > 0)
--- a/scripts/io/strread.m	Wed May 06 18:06:19 2015 +0100
+++ b/scripts/io/strread.m	Thu May 14 08:55:05 2015 -0700
@@ -352,7 +352,7 @@
   ## Remove comments in str
   if (comment_flag)
     ## Expand 'eol_char' here, after option processing which may have set value
-    comment_end = regexprep (comment_end, "eol_char", eol_char);
+    comment_end = strrep (comment_end, "eol_char", eol_char);
     cstart = strfind (str, comment_start);
     cstop  = strfind (str, comment_end);
     ## Treat end of string as additional comment stop
--- a/scripts/plot/util/private/__go_draw_axes__.m	Wed May 06 18:06:19 2015 +0100
+++ b/scripts/plot/util/private/__go_draw_axes__.m	Thu May 14 08:55:05 2015 -0700
@@ -2345,12 +2345,12 @@
         ## FIXME: The symbol font doesn't seem to support bold or italic
         ##if (bld)
         ##  if (it)
-        ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
+        ##    g = strrep (g, '/Symbol', '/Symbol-bolditalic');
         ##  else
-        ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
+        ##    g = strrep (g, '/Symbol', '/Symbol-bold');
         ##  endif
         ##elseif (it)
-        ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
+        ##  g = strrep (g, '/Symbol', '/Symbol-italic');
         ##endif
         str = [str(1:s(i) - 1) g str(e(i) + 1:end)];
       elseif (strncmp (f, "rm", 2))
@@ -2406,12 +2406,12 @@
             ## FIXME: The symbol font doesn't seem to support bold or italic
             ##if (bld)
             ##  if (it)
-            ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
+            ##    g = strrep (g, '/Symbol', '/Symbol-bolditalic');
             ##  else
-            ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
+            ##    g = strrep (g, '/Symbol', '/Symbol-bold');
             ##  endif
             ##elseif (it)
-            ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
+            ##  g = strrep (g, '/Symbol', '/Symbol-italic');
             ##endif
             str = [str(1:s(i) - 1) g str(s(i) + length (flds{j}) + 1:end)];
             break;
--- a/scripts/testfun/private/html_compare_plot_demos.m	Wed May 06 18:06:19 2015 +0100
+++ b/scripts/testfun/private/html_compare_plot_demos.m	Thu May 14 08:55:05 2015 -0700
@@ -113,7 +113,7 @@
           fprintf (fid, "<img src='%s' style='width: %dpx;'>", ...
                         ffn, in.column_width);
         else
-          err_fn = regexprep(ffn, ".png", ".err");
+          err_fn = strrep (ffn, ".png", ".err");
           if (! exist (err_fn, "file"))
             warning("File %s doesn't exist...", err_fn);
           else