# HG changeset patch # User Rik # Date 1431618905 25200 # Node ID 64f817945783529a1db1aff32cfca2f91173a7eb # Parent 38487298513b102b2791ba97f39a087be75a793b 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. diff -r 38487298513b -r 64f817945783 scripts/gui/private/__fltk_file_filter__.m --- 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) diff -r 38487298513b -r 64f817945783 scripts/io/strread.m --- 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 diff -r 38487298513b -r 64f817945783 scripts/plot/util/private/__go_draw_axes__.m --- 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; diff -r 38487298513b -r 64f817945783 scripts/testfun/private/html_compare_plot_demos.m --- 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, "", ... 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