This will definitely not surpass the difference in terms of elegance, but in a different way:
sum(x[-1] != head(x, n=-1))
On my system, this seems faster:
> x <- rbinom(1e6, 1, 0.5) > system.time(replicate(100, sum(x[-1] != head(x, n=-1)))) user system elapsed 8.421 3.688 12.150 > system.time(replicate(100, sum(diff(x) != 0))) user system elapsed 9.431 4.525 14.248
There seems to be a good analytical solution for distributing the number of unequal adjacent elements in a sequence.
source share