From ee200a03b878fceca0e485a55260d8ecf9c5cdaf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 2 Nov 2022 17:25:26 +0100
Subject: [PATCH] isoctave: performance improvement
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Explicitly specify that OCTAVE_VERSION is a builtin. Otherwise the call to
“exists” will look for a file, among other things, which takes a lot of time.
---
 matlab/isoctave.m | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/matlab/isoctave.m b/matlab/isoctave.m
index 4117fee6b5..890a29d908 100644
--- a/matlab/isoctave.m
+++ b/matlab/isoctave.m
@@ -1,6 +1,6 @@
 function A = isoctave()
 
-% Copyright © 2013-2016 Dynare Team
+% Copyright © 2013-2022 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -17,4 +17,6 @@ function A = isoctave()
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
-A = exist('OCTAVE_VERSION');
\ No newline at end of file
+% NB: restricting the search to builtins is important for speed (otherwise it
+% will lookup files, which is slow)
+A = exist('OCTAVE_VERSION', 'builtin');
-- 
GitLab