y =
The class specification of the obj argument seems superflous and should be self-evidently true.
Not necessarily. The first input argument to a class method is not always required to be an instance of that class! There are two common patterns where this may not be the case. Let's take a sym object as an example.
syms x
This command calls the plus method for the sym class, as we can tell using the which function.
y = x + 1
which('plus(x,1)')
This also calls the plus method for the sym class, even though 1 is not a sym. It doesn't call the plus defined for double arrays.
z = 1 + x
which('plus(1, x)')
which('plus(1, 2)')
Another common pattern is when class precedence is involved. [I suppose the example above simplifies down to this as well, since as stated on that documentation page double is always inferior to classes defined using classdef, which is the case for the sym class.] The graph object in MATLAB has an overloaded plot method that can accept an axes handle as its first input.
g = graph(bucky);
ax = axes;
plot(ax, g)
Despite the first input to plot being an axes object, MATLAB calls the graph plot method.
which('plot(ax, g)')
This is because the graph class states that the axes class (technically matlab.graphics.axis.Axes) is one of its InferiorClasses (as listed in the metaclass information.) So if both a graph object and an axes object are in a method's argument list, regardless of the order in which they're listed in that argument list, we call graph's method.
q = ?graph;
{q.InferiorClasses.Name}.'
class(ax)
But to get back to your question about performance, measure it and find out! You'll probably want to use timeit or the Profiler as I suspect the impact with and without the validation is going to be so small tic and toc may not capture it. I strongly suspect that unless your method is very fast (returning a constant value) this probably isn't going to be your bottleneck.