This is my first blog post with "Published with MATLAB R2013b" at the bottom. The latest MATLAB release shipped earlier in September. And, for the first time in a while, a function that I wrote has made it into MATLAB.
Back in 2008, I spent some time trying to incorporate performance benchmarking lessons I learned from Cleve Moler and Bill McKeeman into a general-purpose function for accurately measuring the "typical" running time of MATLAB functions or expressions. The result was timeit, which I submitted to the File Exchange.
Well, I'm happy to say that timeit has made it into MATLAB in the R2013b release! The MATLAB development team took the code from the File Exchange, made some minor refinements, did some additional testing, wrote some nice doc, and got it into the release. (Thanks, everyone!)
Here are a couple of examples. The first one is just MATLAB, but the second one requires Image Processing Toolbox. (Note that it's helpful to know a little about anonymous functions in order to use timeit.)
How much time does it take to compute sum(A.' .* B, 1), where A is 12000-by-400 and B is 400-by-12000?
A = rand(12000,400); B = rand(400,12000); f = @() sum(A.' .* B, 1); timeit(f)
ans = 0.0397
How much time does it take to dilate the text.png image with a 25-by-25 all-ones structuring element?
bw = imread('text.png'); se = strel(ones(25,25)); g = @() imdilate(bw,se); timeit(g)
ans = 7.7779e-04
Loren also wrote about timeit recently in her Art of MATLAB blog.
There are other goodies in R2013b that I'll write about soon.
Have any readers updated to R2013b yet? Any comments?
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.