changeset 28618:af302efce502 stable

avoid some unnecessary work when evaluating index expressions * pt-idx.cc (tree_index_expression::evaluate_n): Don't call varval unnecessarily (inside block where symbols is known to not be a variable). Don't extract the symbol_record from the identifier, then the symbol name from the symbol_record after we have already obtained the name from the identifier.
author John W. Eaton <jwe@octave.org>
date Thu, 13 Aug 2020 18:00:22 -0400
parents 0bac488f17fa
children cd7bbca7eae3 45a9dcee45db
files libinterp/parse-tree/pt-idx.cc
diffstat 1 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-idx.cc	Thu Aug 13 23:55:47 2020 -0400
+++ b/libinterp/parse-tree/pt-idx.cc	Thu Aug 13 18:00:22 2020 -0400
@@ -502,22 +502,17 @@
                 tw.set_lvalue_list (nullptr);
 
                 string_vector anm = *p_arg_nm;
+
                 first_args = tw.convert_to_const_vector (al);
+
                 first_args.stash_name_tags (anm);
               }
 
-            symbol_record sym = id->symbol ();
-
-            octave_value val = tw.varval (sym);
+            interpreter& interp = tw.get_interpreter ();
 
-            if (val.is_undefined ())
-              {
-                interpreter& interp = tw.get_interpreter ();
+            symbol_table& symtab = interp.get_symbol_table ();
 
-                symbol_table& symtab = interp.get_symbol_table ();
-
-                val = symtab.find_function (sym.name (), first_args);
-              }
+            octave_value val = symtab.find_function (nm, first_args);
 
             octave_function *fcn = nullptr;