Efficiency of MOI.CountBelongs

In the JuMP code below, I want to count the number of occurrences of each possible integer in the variable matrix M. s is defined to be a Kx1 variable vector equal to M[:]. Is there any difference in efficiency between
@constraint(model, [i=1:v-1], [n[i]; s] in MOI.CountBelongs(1+K, Set([i])))
versus
@constraint(model, [i=1:v-1], [n[i]; M[:]] in MOI.CountBelongs(1+K, Set([i])))

using JuMP
a = 4
b = 3
K = a*b
v = 16
model = Model()
@variable(model, 1 <= M[1:a,1:b] <= v-1, Int)

@variable(model, 1 <= s[1:K] <= v-1, Int)
@constraint(model, s .== M[:])

@variable(model, 0 <= n[1:v-1] <= K, Int)

n[i] is the count of how many i are in s for 1 <= i <= v-1.

@constraint(model, [i=1:v-1], [n[i]; s] in MOI.CountBelongs(1+K, Set([i])))

vs

@constraint(model, [i=1:v-1], [n[i]; M[:]] in MOI.CountBelongs(1+K, Set([i])))

As a general rule of thumb, more variables and more constraints = worse performance. (Lots of cases where this isn’t true though.)

You should probably just use M everywhere? I don’t understand the need to introduce s.

If you want a vector of the M variables, use vec(M).

Is there a difference between
@constraint(model, [i=1:v-1], [n[i]; M[:]] in MOI.CountBelongs(1+K, Set([i])))
and
@constraint(model, [i=1:v-1], [n[i]; vec(M)] in MOI.CountBelongs(1+K, Set([i]))) ?

No. You should be able to verify by trying it out?