Worked: Take one output neuron with weights w = [+1, 0, -1] acting on inputs x = [a, b, c]. The textbook dot product is 1*a + 0*b + (-1)*c. Rewrite it as selection instead of arithmetic-on-data: keep a (because w=+1), drop b (because w=0), and keep -c (because w=-1). Result: a - c. Notice there is no * touching a, b, or c — only choosing which inputs to add and which to subtract. The 0 weight didn't cost a multiply-by-zero; it cost nothing, because we never looked at b at all.
Your turn: Generalize to a whole matrix W of shape (n_in, n_out). For a fixed input vector x, broadcast it down every column with x[:, None]. Build a "positive contributions" array with np.where(W == 1, x[:, None], 0.0) and a "negative contributions" array with np.where(W == -1, x[:, None], 0.0). Convince yourself that summing the first over axis 0, minus the sum of the second over axis 0, reproduces each column's dot product — with the W == 0 entries contributing a hard zero.
Independent: In the bench, write the single out = ... line using two np.where selections and .sum(0) — no * operator anywhere on x or W. Then read off how many of the weights were zeros: that count is free sparsity, operations you never had to perform.