{"id":3745,"date":"2020-08-16T08:23:08","date_gmt":"2020-08-16T12:23:08","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/?p=3745"},"modified":"2020-09-11T10:17:30","modified_gmt":"2020-09-11T14:17:30","slug":"remove-unneeded-feval-calls","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2020\/08\/16\/remove-unneeded-feval-calls\/","title":{"rendered":"Remove Unneeded feval Calls"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p>Recently I read <a href=\"http:\/\/undocumentedmatlab.com\/articles\/speeding-up-builtin-matlab-functions-part-3\">a post<\/a> about speeding up functions on <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/642467-yair-altman\">Yair's<\/a> blog. I'll take this opportunity, using Release 2020a, to use the updated profiler to investigate performance, particularly for the function <tt><a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020a\/matlab\/ref\/feval.html\">feval<\/a><\/tt>.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#70fa9393-b054-423a-a4f4-3653129196cd\">Code - Attempt 1<\/a><\/li><li><a href=\"#9b72e20d-2514-4be1-8c7f-9dd905b230ed\">Code - Attempt 2<\/a><\/li><li><a href=\"#af0fff26-66e5-4146-b85d-2d4bdd13948a\">Code - Attempt 3<\/a><\/li><li><a href=\"#d63938ab-b72c-4198-82c2-c171a0d289cf\">Code - Attempt 4<\/a><\/li><li><a href=\"#5a648eee-bf27-4e8e-962e-62fb9f067ed6\">Discussion<\/a><\/li><\/ul><\/div><h4>Code - Attempt 1<a name=\"70fa9393-b054-423a-a4f4-3653129196cd\"><\/a><\/h4><p>I've got a simple file to evaluation a function at a bunch of points so the values can be used later, perhaps for a plot.  Here's the code.<\/p><pre class=\"language-matlab\">\r\n<span class=\"keyword\">function<\/span> [ptsToPlot, vals] = myCrudePlotHelperLoopFeval(fh,Nsteps,lims)\r\n<span class=\"comment\">% Crude helper function to prepare function values for plotting<\/span>\r\n<span class=\"comment\">%<\/span>\r\n<span class=\"comment\">% Example:<\/span>\r\n<span class=\"comment\">%  fh = @(x)sqrt(abs(sin(x.^2+17)));<\/span>\r\n<span class=\"comment\">%  [ptsToPlot, vals] = myCrudePlotHelperLoopFeval(fh,50000,[0, pi]);<\/span>\r\n<span class=\"comment\">%  plot(ptsToPlot, vals)<\/span>\r\n<span class=\"comment\">%<\/span>\r\n\r\n<span class=\"keyword\">arguments<\/span>\r\n    fh (1,1) function_handle;\r\n    Nsteps (1,1) double = 100000;\r\n    lims (1,2) double = [-pi, pi];\r\n<span class=\"keyword\">end<\/span>\r\n\r\n\r\nsm = min(lims);\r\nlg = max(lims);\r\n<span class=\"comment\">% Nsteps+1 = number of points to create.  1\/N helps determine the stepsize.<\/span>\r\n<span class=\"comment\">% 100000 is far more points than we need, but I want to do a bunch of<\/span>\r\n<span class=\"comment\">% meaningful computation so we get a reasonable reading.<\/span>\r\n\r\n<span class=\"comment\">% Get x-axis for points to plot.<\/span>\r\nptsToPlot = (sm:((lg-sm)\/Nsteps):lg)'; \r\n<span class=\"comment\">% Compute output using feval in a loop.<\/span>\r\n<span class=\"keyword\">for<\/span> ind = 1:length(ptsToPlot)\r\n    vals(ind,1) = feval(fh, ptsToPlot(ind));\r\n<span class=\"keyword\">end<\/span>\r\n\r\n\r\n\r\n\r\n<\/pre><p>I am using the Run and Time feature on the Home Toolstrip for my time measurements here.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/runAndTime.png\" alt=\"\"> <\/p><p>I will call all variants of this function with the same inputs - fair's fair!  First I'll set up the parameters.<\/p><pre class=\"codeinput\">Nsteps = 50000;\r\nlims = [0 pi];\r\n<\/pre><p>And next run the following code in the text box to the left of the Run and Time widget on the right side of the profiler:<\/p><p>[ptsToPlot, vals] = myCrudePlotHelperLoopFeval(fh,Nsteps,lims);<\/p><p>and we see this afterwards<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/initialProfileFlame.png\" alt=\"\"> <\/p><p>It took 0.034 seconds.  Otherwise, this is not so useful yet, so I click on the name of my function in the flame graph at the top to see what happened in my file.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/profile1.png\" alt=\"\"> <\/p><p>It shows me that I am calling line 27, with <tt>feval<\/tt>, many times. Scrolling down further, I get some more information from the Code Analyzer results.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/codeAnalyzer1.png\" alt=\"\"> <\/p><p>It notices that I did not preallocate the output vector, although it seems I should know the size.<\/p><p>Aside: notice the use of the <tt>arguments<\/tt> block for error checking.<\/p><h4>Code - Attempt 2<a name=\"9b72e20d-2514-4be1-8c7f-9dd905b230ed\"><\/a><\/h4><p>Next we'll see what happens when I preallocate the vector for the output.<\/p><pre class=\"language-matlab\">\r\n<span class=\"keyword\">function<\/span> [ptsToPlot, vals] = <span class=\"keyword\">...<\/span>\r\n    myCrudePlotHelperPreAllocLoopFeval(fh,Nsteps,lims)\r\n<span class=\"comment\">% Crude helper function to prepare function values for plotting<\/span>\r\n<span class=\"comment\">%<\/span>\r\n<span class=\"comment\">% Example:<\/span>\r\n<span class=\"comment\">%  fh = @(x)sqrt(abs(sin(x.^2+17)));<\/span>\r\n<span class=\"comment\">%  [ptsToPlot, vals] = myCrudePlotHelperLoopFeval(fh,50000,[0, pi]);<\/span>\r\n<span class=\"comment\">%  plot(ptsToPlot, vals)<\/span>\r\n<span class=\"comment\">%<\/span>\r\n\r\n<span class=\"keyword\">arguments<\/span>\r\n    fh (1,1) function_handle;\r\n    Nsteps (1,1) double = 100000;\r\n    lims (1,2) double = [-pi, pi];\r\n<span class=\"keyword\">end<\/span>\r\n\r\n\r\nsm = min(lims);\r\nlg = max(lims);\r\n<span class=\"comment\">% Nsteps+1 = number of points to create.  1\/N helps determine the stepsize.<\/span>\r\n<span class=\"comment\">% 100000 is far more points than we need, but I want to do a bunch of<\/span>\r\n<span class=\"comment\">% meaningful computation so we get a reasonable reading.<\/span>\r\n\r\n<span class=\"comment\">% Get x-axis for points to plot.<\/span>\r\nptsToPlot = (sm:((lg-sm)\/Nsteps):lg)'; \r\n<span class=\"comment\">% Compute output using feval in a loop.<\/span>\r\nvals = zeros(size(ptsToPlot));\r\n<span class=\"keyword\">for<\/span> ind = 1:length(ptsToPlot)\r\n    vals(ind,1) = feval(fh, ptsToPlot(ind));\r\n<span class=\"keyword\">end<\/span>\r\n\r\n\r\n\r\n\r\n<\/pre><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/profile2.png\" alt=\"\"> <\/p><p>Time is down to 0.026 seconds.<\/p><h4>Code - Attempt 3<a name=\"af0fff26-66e5-4146-b85d-2d4bdd13948a\"><\/a><\/h4><p>Next I want to lose the loop altogether and see what happens.<\/p><pre class=\"language-matlab\">\r\n<span class=\"keyword\">function<\/span> [ptsToPlot, vals] = myCrudePlotHelperFeval(fh,Nsteps,lims)\r\n<span class=\"comment\">% Crude helper function to prepare function values for plotting<\/span>\r\n<span class=\"comment\">%<\/span>\r\n<span class=\"comment\">%<\/span>\r\n<span class=\"comment\">% Example:<\/span>\r\n<span class=\"comment\">%  fh = @(x)sqrt(abs(sin(x.^2+17)));<\/span>\r\n<span class=\"comment\">%  [ptsToPlot, vals] = myCrudePlotHelperLoopFeval(fh,50000,[0, pi]);<\/span>\r\n<span class=\"comment\">%  plot(ptsToPlot, vals)<\/span>\r\n<span class=\"comment\">%<\/span>\r\n\r\n<span class=\"keyword\">arguments<\/span>\r\n    fh (1,1) function_handle;\r\n    Nsteps (1,1) double = 100000;\r\n    lims (1,2) double = [-pi, pi];\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"comment\">%<\/span>\r\n\r\n<span class=\"comment\">% Check input arguments - should be 1 or 2.  Second should be real-valued<\/span>\r\n<span class=\"comment\">% 2-element vector.<\/span>\r\n<span class=\"keyword\">if<\/span> nargin &lt; 1\r\n    error(<span class=\"string\">\"Not enough input arguments.\"<\/span>)\r\n<span class=\"keyword\">elseif<\/span> nargin == 1\r\n    lims = [-pi, pi];\r\n<span class=\"keyword\">else<\/span>\r\n    <span class=\"keyword\">if<\/span> length(lims) ~= 2 || ~isreal(lims)\r\n        error(<span class=\"string\">\"The second input must be a 2-element real vector.\"<\/span>)\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\nsm = min(lims);\r\nlg = max(lims);\r\n<span class=\"comment\">% N+1 = number of points to create.  1\/N helps determine the stepsize.<\/span>\r\n<span class=\"comment\">% 100000 is far more points than we need, but I want to do a bunch of<\/span>\r\n<span class=\"comment\">% meaningful computation so we get a reasonable reading.<\/span>\r\nN = 100000;\r\n<span class=\"comment\">% Get x-axis for points to plot.<\/span>\r\nptsToPlot = (sm:((lg-sm)\/N):lg)';  \r\n<span class=\"comment\">% doing a vectorized feval, and a vectorized evaluation without feval.<\/span>\r\nvals = feval(fh, ptsToPlot);\r\n\r\n\r\n\r\n<\/pre><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/profile3.png\" alt=\"\"> <\/p><p>Time is down to 0.015 seconds.  It pays to call our function once instead of Nsteps times!<\/p><h4>Code - Attempt 4<a name=\"d63938ab-b72c-4198-82c2-c171a0d289cf\"><\/a><\/h4><p>And now I am going to remove the call to <tt>feval<\/tt> completely as it hasn't been necessary for calling function handles in a very long time.<\/p><pre class=\"language-matlab\">\r\n<span class=\"keyword\">function<\/span> [ptsToPlot, vals] = myCrudePlotHelperNoFeval(fh,Nsteps,lims)\r\n<span class=\"comment\">% Crude helper function to prepare function values for plotting<\/span>\r\n<span class=\"comment\">%<\/span>\r\n<span class=\"comment\">% Example:<\/span>\r\n<span class=\"comment\">%  fh = @(x)sqrt(abs(sin(x.^2+17)));<\/span>\r\n<span class=\"comment\">%  [ptsToPlot, vals] = myCrudePlotHelperLoopFeval(fh,50000,[0, pi]);<\/span>\r\n<span class=\"comment\">%  plot(ptsToPlot, vals)<\/span>\r\n<span class=\"comment\">%<\/span>\r\n\r\n<span class=\"keyword\">arguments<\/span>\r\n    fh (1,1) function_handle;\r\n    Nsteps (1,1) double = 100000;\r\n    lims (1,2) double = [-pi, pi];\r\n<span class=\"keyword\">end<\/span>\r\n\r\nsm = min(lims);\r\nlg = max(lims);\r\n<span class=\"comment\">% Nsteps+1 = number of points to create.  1\/N helps determine the stepsize.<\/span>\r\n<span class=\"comment\">% 100000 is far more points than we need, but I want to do a bunch of<\/span>\r\n<span class=\"comment\">% meaningful computation so we get a reasonable reading.<\/span>\r\n\r\n<span class=\"comment\">% Get x-axis for points to plot.<\/span>\r\nptsToPlot = (sm:((lg-sm)\/Nsteps):lg)';  \r\n<span class=\"comment\">% Compute vectorized evaluation without feval.<\/span>\r\nvals = fh(ptsToPlot);\r\n\r\n\r\n\r\n<\/pre><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/profile4.png\" alt=\"\"> <\/p><p>We reduced the time to 0.013s now - not dramatic compared to the other version with preallocation.  But MUCH improved over the earlier ones.<\/p><h4>Discussion<a name=\"5a648eee-bf27-4e8e-962e-62fb9f067ed6\"><\/a><\/h4><p>The reason I care about the overhead for <tt>feval<\/tt> is there are times when we are doing some calculation that is adaptive or iterative.  In that case, we don't have the luxury of making all of our calculations in a single call.  So I am trying to squeeze out as much performance from the basic calculation so extra unnecessary stuff has no chance to dominate.<\/p><p>Here's my final comparison, with a preallocated variable in a loop, without <tt>feval<\/tt>.<\/p><pre class=\"language-matlab\">\r\n<span class=\"keyword\">function<\/span> [ptsToPlot, vals] = <span class=\"keyword\">...<\/span>\r\n    myCrudePlotHelperPreAllocLoopFeval(fh,Nsteps,lims)\r\n<span class=\"comment\">% Crude helper function to prepare function values for plotting<\/span>\r\n<span class=\"comment\">%<\/span>\r\n<span class=\"comment\">% Example:<\/span>\r\n<span class=\"comment\">%  fh = @(x)sqrt(abs(sin(x.^2+17)));<\/span>\r\n<span class=\"comment\">%  [ptsToPlot, vals] = myCrudePlotHelperLoopFeval(fh,50000,[0, pi]);<\/span>\r\n<span class=\"comment\">%  plot(ptsToPlot, vals)<\/span>\r\n<span class=\"comment\">%<\/span>\r\n\r\n<span class=\"keyword\">arguments<\/span>\r\n    fh (1,1) function_handle;\r\n    Nsteps (1,1) double = 100000;\r\n    lims (1,2) double = [-pi, pi];\r\n<span class=\"keyword\">end<\/span>\r\n\r\n\r\nsm = min(lims);\r\nlg = max(lims);\r\n<span class=\"comment\">% Nsteps+1 = number of points to create.  1\/N helps determine the stepsize.<\/span>\r\n<span class=\"comment\">% 100000 is far more points than we need, but I want to do a bunch of<\/span>\r\n<span class=\"comment\">% meaningful computation so we get a reasonable reading.<\/span>\r\n\r\n<span class=\"comment\">% Get x-axis for points to plot.<\/span>\r\nptsToPlot = (sm:((lg-sm)\/Nsteps):lg)'; \r\n<span class=\"comment\">% Compute output using feval in a loop.<\/span>\r\nvals = zeros(size(ptsToPlot));\r\n<span class=\"keyword\">for<\/span> ind = 1:length(ptsToPlot)\r\n    vals(ind,1) = fh(ptsToPlot(ind));\r\n<span class=\"keyword\">end<\/span>\r\n\r\n\r\n\r\n\r\n<\/pre><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/profile5.png\" alt=\"\"> <\/p><p>Time is in the middle, 0.024 seconds<\/p><p>So lots of gain from vectorization, but some gain, possibly worthwhile, for removing the overhead of <tt>feval<\/tt>.<\/p><p>Could this make a difference in some computational bottlenecks in your code?  Let us know <a href=\"https:\/\/blogs.mathworks.com\/loren\/?p=3745#respond\">here<\/a>.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_fb8e5288eec14cb9beeb190ab65c0114() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='fb8e5288eec14cb9beeb190ab65c0114 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' fb8e5288eec14cb9beeb190ab65c0114';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2020 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_fb8e5288eec14cb9beeb190ab65c0114()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2020a<br><\/p><\/div><!--\r\nfb8e5288eec14cb9beeb190ab65c0114 ##### SOURCE BEGIN #####\r\n%% Remove Unneeded feval Calls\r\n% Recently I read\r\n% <http:\/\/undocumentedmatlab.com\/articles\/speeding-up-builtin-matlab-functions-part-3\r\n% a post> about speeding up functions on\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/642467-yair-altman\r\n% Yair's> blog. I'll take this opportunity, using Release 2020a, to use\r\n% the updated profiler to investigate performance, particularly for the\r\n% function\r\n% |<https:\/\/www.mathworks.com\/help\/releases\/R2020a\/matlab\/ref\/feval.html\r\n% feval>|.\r\n%% Code - Attempt 1\r\n% I've got a simple file to evaluation a function at a bunch of points so\r\n% the values can be used later, perhaps for a plot.  Here's the code.\r\n% \r\n% <include>myCrudePlotHelperLoopFeval<\/include>\r\n%%\r\n% I am using the Run and Time feature on the Home Toolstrip for my time\r\n% measurements here.\r\n%\r\n% <<runAndTime.png>>\r\n%\r\n% I will call all variants of this function with the same inputs - fair's\r\n% fair!  First I'll set up the parameters.\r\nNsteps = 50000;\r\nlims = [0 pi];\r\n%%\r\n% And next run the following code in the text box to the left of the Run\r\n% and Time widget on the right side of the profiler:\r\n%\r\n% [ptsToPlot, vals] = myCrudePlotHelperLoopFeval(fh,Nsteps,lims);\r\n%\r\n% and we see this afterwards\r\n%\r\n% <<initialProfileFlame.png>>\r\n%\r\n% It took 0.034 seconds.  Otherwise, this is not so useful yet, so I click\r\n% on the name of my function in the flame graph at the top to see what\r\n% happened in my file.\r\n%\r\n% <<profile1.png>>\r\n%\r\n% It shows me that I am calling line 27, with |feval|, many times.\r\n% Scrolling down further, I get some more information from the Code\r\n% Analyzer results.  \r\n%\r\n% <<codeAnalyzer1.png>>\r\n% \r\n%%\r\n% It notices that I did not preallocate the output\r\n% vector, although it seems I should know the size.\r\n%\r\n% Aside: notice the use of the |arguments| block for error checking.\r\n\r\n%% Code - Attempt 2\r\n% Next we'll see what happens when I preallocate the vector for the output.\r\n% \r\n% <include>myCrudePlotHelperPreallocLoopFeval.m<\/include>\r\n%\r\n% <<profile2.png>>\r\n%\r\n% Time is down to 0.026 seconds.\r\n\r\n\r\n%% Code - Attempt 3\r\n% Next I want to lose the loop altogether and see what happens.\r\n%\r\n% <include>myCrudePlotHelperFeval.m<\/include>\r\n%\r\n% <<profile3.png>>\r\n%\r\n% Time is down to 0.015 seconds.  It pays to call our function once instead\r\n% of Nsteps times!\r\n\r\n%% Code - Attempt 4\r\n% And now I am going to remove the call to |feval| completely as it hasn't\r\n% been necessary for calling function handles in a very long time. \r\n%\r\n% <include>myCrudePlotHelperNoFeval.m<\/include>\r\n%\r\n% <<profile4.png>>\r\n%\r\n% We reduced the time to 0.013s now - not dramatic compared to the other\r\n% version with preallocation.  But MUCH improved over the earlier ones.\r\n%\r\n %% Discussion\r\n% The reason I care about the overhead for |feval| is there are times when\r\n% we are doing some calculation that is adaptive or iterative.  In that\r\n% case, we don't have the luxury of making all of our calculations in a\r\n% single call.  So I am trying to squeeze out as much performance from the\r\n% basic calculation so extra unnecessary stuff has no chance to dominate.\r\n%\r\n% Here's my final comparison, with a preallocated variable in a loop,\r\n% without |feval|.\r\n%\r\n% <include>myCrudePlotHelperPreAllocLoopNoFeval.m<\/include>\r\n%\r\n% <<profile5.png>>\r\n%\r\n% Time is in the middle, 0.024 seconds\r\n%\r\n% So lots of gain from vectorization, but some gain, possibly worthwhile,\r\n% for removing the overhead of |feval|.\r\n%\r\n% Could this make a difference in some computational bottlenecks in your\r\n% code?  Let us know <https:\/\/blogs.mathworks.com\/loren\/?p=3745#respond\r\n% here>.\r\n\r\n##### SOURCE END ##### fb8e5288eec14cb9beeb190ab65c0114\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/profile5.png\" onError=\"this.style.display ='none';\" \/><\/div><!--introduction--><p>Recently I read <a href=\"http:\/\/undocumentedmatlab.com\/articles\/speeding-up-builtin-matlab-functions-part-3\">a post<\/a> about speeding up functions on <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/642467-yair-altman\">Yair's<\/a> blog. I'll take this opportunity, using Release 2020a, to use the updated profiler to investigate performance, particularly for the function <tt><a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020a\/matlab\/ref\/feval.html\">feval<\/a><\/tt>.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2020\/08\/16\/remove-unneeded-feval-calls\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,79,58],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/3745"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=3745"}],"version-history":[{"count":10,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/3745\/revisions"}],"predecessor-version":[{"id":3812,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/3745\/revisions\/3812"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=3745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=3745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=3745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}