Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/matlab-software-development/matlab-optimize-performance

matlab-optimize-performance

Unverified

Use when MATLAB code is too slow or the user wants it faster, or asks to profile it, find its hot line or where the time goes, count how many times a function runs, or benchmark or compare timings. Profiles before changing code (Sampling Profiler on R2026b+), checks the output against the original, and reports only measured speedups. Not for writing performance tests.

scripts/assertSamplingProfiler.m

View on GitHub
function assertSamplingProfiler()
%ASSERTSAMPLINGPROFILER Error early if the Sampling Profiler is unavailable.
%
%   assertSamplingProfiler()
%
% The Sampling Profiler entry points (quick_profile, profile_function,
% profile_script, profile_test) need R2026b or newer. Call this first so that on
% an older release the caller gets a clear, actionable message pointing at the
% MATLAB profiler (Step 2) instead of failing partway through.
%
% Detection is sampling_profiler('available'), which never errors.

    if ~sampling_profiler('available')
        error('SamplingProfiler:notAvailable', ...
            ['The Sampling Profiler is not ' ...
             'available on this release — it requires R2026b or newer. Use the ' ...
             'MATLAB profiler instead (Step 2):\n' ...
             '    profile on; yourCode(); profile off; profile viewer']);
    end
end

% Copyright 2026 The MathWorks, Inc.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 318kUpdated Claude CodeCodexUnverifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 318kUpdated Claude CodeCodexUnverifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 318kUpdated Claude CodeCodexUnverifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 196kUpdated Claude CodeCodexVerifiedInstall