Faster than { count each group x }

Is there a way of doing this more efficiently (in a “wj”)?q) count each group 1 2 3 4 5 1 1 21| 32| 23| 14| 15| 1This does all the work associated with the “group” operator, but thenit throws a lot of that away when all we want is a “count”. Seemswasteful, so I wondered if there was a better (more efficient way).I’ve become aware of this alternative way of counting:q) a:()!()q) a[1 2 3 4 5 1 1 2] +: 1"a" is now the same result as “count each group” but it’s 30% slowerwhen I use it within a “wj” like this:q) f: { a:()!(); a +: 1} / this isvariation #1q) g: { count each group x} / this is variation#2q) wj[w;szt;t;(vv;(f;pid))] / here iswhere we might use either ‘f’ or ‘g’, using ‘f’ currentlyusing ‘f’ instead of ‘g’ is 30% slower.Any ideas how I can make a faster ‘f’ or 'g’Cheers,Mike